Skip to content
Calm motion: animations on this site only fade, with no movement

Floor plan ​

The rooms of a home with the devices in each room

Shows a home as a simple plan in a smart home app. The reader picks a room to see its devices. The plan is a grid of cells, not a drawing to scale.

Basic

Studio

Desk lamp

On

Air conditioner

On

  • rooms is a list of rooms. Each room has an id and a name. x and y give its place, and w and h give its size, in grid cells from the top left.
  • columns is the number of cells across the plan (default 12). Each row of cells is 3rem high.
  • devices is a list of devices. Each device has an id, a name, the room id, an optional icon, and on.
  • Each room is a button with its name and a count in words, such as "2 devices, 1 on". The icons of devices that are off are gray.
  • v-model is the id of the open room. A second click closes it. The open room is pressed and has a thick inner edge.
  • The room slot gets the open room and its devices. Put device tiles in it.
  • Change the words with labels or a label pack: title and devices (a function).

Usage ​

ts
import { BlessFloorPlan } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
rooms*BlessRoom[]—
devicesBlessRoomDevice[][]
columnsnumber12the number of grid columns of the plan
labelsPartial<{ title: string; devices: (count: number, on: number) => string; }>—
modelValuestring—the id of the open room

Events

NamePayloadDescription
update:modelValue[value: string | undefined]

Slots

NameScopeDescription
room{ room: BlessRoom; devices: BlessRoomDevice[]; }

Released under the MIT License. Character names and artwork belong to their owners.