# Home

> The home in glass over Ambient: heating with a target, lights, robot vacuum, air purifier, a camera and a sensor, the car charging and what plays in the living room, with Home / Away / Night.

Pattern · Pro kit · [Live page](https://ui.twentyfirst.media/pro/patterns/HomeScreen/)

The home in glass over `Ambient`: heating with a target, lights, robot vacuum, air purifier, a
camera and a sensor, the car charging and what plays in the living room, with Home / Away / Night.

## Code

```tsx
import * as React from "react";
import {
  Ambient,
  AppShell,
  DeviceTile,
  NowPlaying,
  PageHeader,
  Segmented,
  Stagger,
  UIProvider,
  VehicleCard,
} from "@twentyfirstmedia/pro";
import "./_connectors";
import { LIFE_NAV } from "./_lifenav";

const grid = {
  "--cols": "repeat(3, minmax(0, 1fr))",
  "--cols-sm": "1fr",
  gap: 16,
} as React.CSSProperties;

/** The home: heating, lights, robot vacuum, air and cameras, the car charging and what plays, in glass. */
export default function Preview() {
  const [target, setTarget] = React.useState(21.5);
  const [lights, setLights] = React.useState(true);
  const [mode, setMode] = React.useState("home");
  return (
    <UIProvider scope="subtree" surface="glass">
      <Ambient />
      <AppShell
        navigation="sidebar"
        brand="Life"
        sidebarGroups={LIFE_NAV}
        active="home"
        user={{ name: "Mara Ellis", email: "mara@halo.app" }}
        dock={false}
      >
        <div className="tf-in">
          <PageHeader
            title="Home"
            subtitle="6 rooms · 2 people home"
            actions={[
              <Segmented
                key="mode"
                label="Mode"
                value={mode}
                onChange={setMode}
                options={[
                  { value: "home", label: "Home" },
                  { value: "away", label: "Away" },
                  { value: "night", label: "Night" },
                ]}
              />,
            ]}
          />
        </div>
        <Stagger className="tf-col" style={{ gap: 16 }}>
          <div className="tf-grid" style={grid}>
            <DeviceTile
              kind="thermostat"
              name="Living room"
              room="Heating"
              on
              value="20.8 °C"
              status="Heating · humidity 46 %"
              target={target}
              onTarget={setTarget}
              service={{ name: "tado°", icon: "brandTado" }}
            />
            <DeviceTile
              kind="light"
              name="All lights"
              room="5 on"
              on={lights}
              onToggle={setLights}
              value={lights ? "Evening" : undefined}
              status={lights ? "Scene from Philips Hue" : undefined}
              service={{ name: "Philips Hue", icon: "brandHue" }}
            />
            <DeviceTile
              kind="vacuum"
              name="Robot vacuum"
              room="Ground floor"
              on
              value="Cleaning"
              status="Hallway · 18 m² to go"
              battery={64}
              actions={[
                { label: "Pause", icon: "pause" },
                { label: "Dock", icon: "home" },
              ]}
            />
            <DeviceTile
              kind="purifier"
              name="Air purifier"
              room="Bedroom"
              on
              value="AQI 12"
              status="Good · night mode at 22:00"
              onToggle={() => {}}
            />
            <DeviceTile
              kind="camera"
              name="Front door"
              room="Doorbell"
              on
              value="Live"
              status="Last ring 14:02"
            />
            <DeviceTile
              kind="sensor"
              name="Office window"
              room="Contact sensor"
              on={false}
              value="Closed"
              battery={12}
            />
          </div>
          <div
            className="tf-grid"
            style={
              {
                "--cols": "minmax(0, 1fr) minmax(0, 1fr)",
                "--cols-sm": "1fr",
                gap: 16,
              } as React.CSSProperties
            }
          >
            <VehicleCard
              name="Model Y"
              model="In the garage"
              battery={58}
              range={287}
              limit={80}
              charging="charging"
              power={11}
              until={new Date(2026, 10, 15, 6, 30)}
              locked
              climateOn={false}
              inside={9}
              onLock={() => {}}
              onClimate={() => {}}
              service={{ name: "Tesla", icon: "brandTesla" }}
            />
            <NowPlaying
              title="Weightless"
              artist="Marconi Union"
              position={203}
              duration={488}
              playing
              device="Living room speaker"
              onPlayPause={() => {}}
              onNext={() => {}}
              onPrevious={() => {}}
              service={{ name: "Spotify", icon: "brandSpotify" }}
            />
          </div>
        </Stagger>
      </AppShell>
    </UIProvider>
  );
}
```

## Props

### Ambient

| Prop | Type | Notes |
| --- | --- | --- |
| `colors?` | `string[]` | Colours of the soft fields (any CSS colour); default the kit's `--ambient-1…4`. |
| `src?` | `string` | A photo (or, with `video`, a video) instead of the fields, under a scrim that keeps it calm. |
| `video?` | `boolean` | Treat `src` as a video (muted, looping, still with motion off). |
| `animate?` | `boolean` | Let the fields drift slowly (default true). Still with motion off; paused off screen. |
| `fixed?` | `boolean` | Cover the window behind the page instead of the nearest container. |
| `children?` | `ReactNode` | Your own layer (a canvas, WebGL, a map) instead of fields or media. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### AppShell

| Prop | Type | Notes |
| --- | --- | --- |
| `active?` | `string` |  |
| `brand?` | `ReactNode` | The product name, or a node (a logo mark with the name; collapsed sidebars show it whole). |
| `brandDot?` | `boolean` | The status dot after the brand (default `true`); turn it off next to a logo of your own. |
| `tag?` | `string` |  |
| `nav?` | `NavItem[]` |  |
| `user?` | `{ name: string; email?: string }` |  |
| `onNavigate?` | `(label: string) => void` |  |
| `topExtra?` | `ReactNode` |  |
| `sheetStyle?` | `CSSProperties` |  |
| `contentKey?` | `string \| number` |  |
| `side?` | `ReactNode` |  |
| `dock?` | `boolean` |  |
| `dockItems?` | `DockProps["items"]` |  |
| `railTop?` | `RailItem[]` |  |
| `railBottom?` | `RailItem[]` |  |
| `fill?` | `boolean` | The shell is the whole page: at least the viewport's height (100dvh), no outer radius, the sheet fills the rest; on desktop the sidebar stays in view while the page scrolls, on phones the sheet starts right under the sidebar's bar. |
| `navigation?` | `"top" \| "sidebar"` |  |
| `sidebarGroups?` | `SidebarGroup[]` | With `navigation="sidebar"`: groups instead of the flat `nav` list. |
| `sidebar?` | `Partial<Omit<SidebarProps, "variant" \| "groups">>` | With `navigation="sidebar"`: more sidebar props (collapsed, storageKey, shortcut, linkAs …). |
| `workspaces?` | `WorkspaceSwitcherProps` | With `navigation="sidebar"`: the workspace switcher at the top instead of the brand. |
| `userMenu?` | `(MenuItem \| "-")[]` | The account menu's entries (with `navigation="sidebar"` at the foot of the sidebar). |
| `topbar?` | `boolean \| ReactNode` | With `navigation="sidebar"`: a bar across the top of the frame. The brand (or `workspaces`) moves into its start, as wide as the sidebar below it (expanded or collapsed); `topStart` follows it, `topEnd` sits at the end. Frame, bar and sidebar read as one L around the sheet. Content given here goes between `topStart` and `topEnd`. On phones the bar is the sidebar's bar (menu button and brand) with `topEnd` on the right and `topStart` behind an icon button. |
| `topStart?` | `ReactNode` | With `topbar`: right after the brand, e.g. a search field or a command palette trigger. |
| `topEnd?` | `ReactNode` | With `topbar`: at the end of the bar (buttons, menus); `topExtra` goes there too. |
| `topStartCompact?` | `ReactNode` | With `topbar` on phones: what stands in for `topStart` (default: an icon button that opens `topStart` over the bar). |
| `topStartIcon?` | `IconName` | The icon of that button (default `search`). |
| `topStartLabel?` | `string` | The accessible name of that button (default "Search"). |
| `children?` | `ReactNode` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### DeviceTile

| Prop | Type | Notes |
| --- | --- | --- |
| `name` | `string` | Required |
| `room?` | `string` |  |
| `icon?` | `IconName` |  |
| `kind?` | `"switch" \| "light" \| "thermostat" \| "vacuum" \| "purifier" \| "camera" \| "lock" \| "sensor"` | The kind sets the default icon and which controls appear. |
| `on?` | `boolean` | On or off; with `onToggle` a switch. |
| `onToggle?` | `(on: boolean) => void` |  |
| `value?` | `ReactNode` | The main reading: "21.5 °C", "Cleaning", "AQI 12". |
| `status?` | `ReactNode` | A line under the value: "Heating to 22 °C", "Kitchen · 18 m² left". |
| `target?` | `number` | Thermostat target in °C; with `onTarget` a − / + stepper (steps of `step`, default 0.5). |
| `onTarget?` | `(value: number) => void` |  |
| `step?` | `number` |  |
| `battery?` | `number` | Battery in percent (vacuums, sensors, locks). |
| `actions?` | `{ label: string; icon?: IconName; onClick?: () => void }[]` | Quick actions: "Start", "Dock", "Boost". |
| `offline?` | `boolean` | The device does not answer. |
| `service?` | `ServiceRef` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### NowPlaying

| Prop | Type | Notes |
| --- | --- | --- |
| `title` | `string` | Required |
| `artist?` | `string` |  |
| `album?` | `string` |  |
| `art?` | `ReactNode` | Cover art: an `<img>`. |
| `position?` | `number` | Position and length in seconds. |
| `duration?` | `number` |  |
| `playing?` | `boolean` |  |
| `device?` | `string` | Where it plays: "Living room speaker". |
| `onPlayPause?` | `() => void` |  |
| `onNext?` | `() => void` |  |
| `onPrevious?` | `() => void` |  |
| `service?` | `ServiceRef` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### PageHeader

| Prop | Type | Notes |
| --- | --- | --- |
| `crumbs?` | `(string \| Crumb)[]` | A breadcrumb above the title (see `Breadcrumb`): labels, or items with `href`/`onClick`. |
| `crumbLinkAs?` | `ElementType` | The element crumb links render as, e.g. Next.js `Link`. |
| `title` | `string` | Required |
| `subtitle?` | `string` |  |
| `actions?` | `ReactNode[]` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Segmented

| Prop | Type | Notes |
| --- | --- | --- |
| `options` | `(string \| Option)[]` | Required |
| `value?` | `string` |  |
| `defaultValue?` | `string` |  |
| `onChange?` | `(v: string) => void` |  |
| `size?` | `"sm"` |  |
| `block?` | `boolean` |  |
| `label?` | `string` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### VehicleCard

| Prop | Type | Notes |
| --- | --- | --- |
| `name` | `string` | Required |
| `model?` | `string` |  |
| `battery` | `number` | Battery (or tank) in percent. |
| `range?` | `number` | Range in km. |
| `limit?` | `number` | The charge limit in percent, marked on the bar. |
| `charging?` | `"charging" \| "complete" \| "plugged" \| "unplugged"` |  |
| `power?` | `number` | Charging power in kW while charging. |
| `until?` | `Date \| string \| number` | When charging reaches the limit. |
| `locked?` | `boolean` |  |
| `inside?` | `number` | Inside temperature in °C. |
| `climateOn?` | `boolean` |  |
| `location?` | `ReactNode` |  |
| `onLock?` | `(locked: boolean) => void` |  |
| `onClimate?` | `(on: boolean) => void` |  |
| `service?` | `ServiceRef` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
