Desk lamp
Studio
On · Brightness 80%
English
A device with its state, a switch, and the main reading
Shows one device in a smart home app. Put many tiles in a grid for a room. For a group of devices that change together, use the scene buttons.
Studio
On · Brightness 80%
Studio
Off
Studio
On · 22 °C
Hall
Closed
Storage
Offline
<template>
<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px"
>
<BlessDeviceTile
v-model="lamp"
name="Desk lamp"
room="Studio"
icon="💡"
reading="Brightness 80%"
/>
<BlessDeviceTile v-model="sign" name="On air sign" room="Studio" icon="🔴" />
<BlessDeviceTile v-model="ac" name="Air conditioner" room="Studio" icon="❄️" reading="22 °C" />
<BlessDeviceTile name="Door" room="Hall" icon="🚪" reading="Closed" sensor />
<BlessDeviceTile name="Dehumidifier" room="Storage" icon="💧" offline />
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { BlessDeviceTile } from "blessing-ui";
const lamp = ref(true);
const sign = ref(false);
const ac = ref(true);
</script>name is the name of the device. room, icon, and reading are optional. The reading is text, such as "22 °C" or "Closed".v-model is true. The switch is named with the device, such as "Power, Desk lamp".offline turns the switch off and shows "Offline" with a dashed edge.sensor is for a device that only reads, such as a door sensor. It has no switch.labels or a label pack: on, off, offline, and power (a function).import { BlessDeviceTile } from "blessing-ui";| Name | Type | Default | Description |
|---|---|---|---|
name* | string | — | |
room | string | — | the room, for example "Studio" |
icon | string | — | an emoji or a short text for the device |
reading | string | — | the main reading, as text, for example "21.5 °C" or "Door closed" |
offline | boolean | — | the device does not answer: the switch is off and the tile says so |
sensor | boolean | — | a sensor has no switch |
labels | Partial<{ on: string; off: string; offline: string; power: (name: string) => string; }> | — | |
modelValue | boolean | false |
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: boolean] |