Skip to content
Sign upPro
FramesHome widgetsMenu

Home widgets

Phone widgets in the standard home and lock screen sizes that show an agent's progress while its app is closed: research running, flights being compared, a task finishing.

A trip planner works while the app is closed: the research gauge fills, flights are compared one by one, then both finish and the line over the clock says the plan is ready. Loops.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/home-widgets.json

Usage

tsx
import { HomeScreen, WidgetLabel, WidgetProgress } from "@/components/ui/chatcn/home-widgets"
import { PlainScreen } from "@/components/ui/chatcn/plain-screen"
import { SearchIcon } from "@/lib/chatcn-icons"

<PlainScreen width={360} safe={{ top: 59 }}>
  <HomeScreen
    widgets={[
      {
        id: "trip",
        size: "medium",
        label: "Trip planner",
        row: 1,
        content: (
          <>
            <WidgetLabel icon={<SearchIcon />}>Trip planner</WidgetLabel>
            <WidgetProgress
              className="mt-2"
              title="Researching your Lisbon trip"
              step={3}
              steps={5}
              detail="Reading hotel reviews"
            />
          </>
        ),
      },
    ]}
  />
</PlainScreen>

The home screen is a grid of four 60 px cells with 35 px gaps, 24 px in from each side of a 393 px screen. Widgets span whole cells, so a small widget is 155 by 155, a medium one 345 by 155 and a large one 345 by 345, and their edges line up with the app squares. A widget's 24 px corner sits 24 px in from the screen's 48 px corner, so the two are concentric, and its 16 px padding leaves 8 px for anything inside with a fill. The dock is inset 8 px with 40 px ends for the same reason. App squares are blank with one muted kit icon each, never a logo, and are hidden from screen readers; free cells fill with them in order.

Lock sizes have no card. inline is one line beside the date, circular is 72 px and rectangular is 160 by 72, which is two circular slots and the 16 px gap between them. LockScreen sets the date line at 17 px, the clock at 84 px in the regular weight, the widget row under it, and the flashlight and camera buttons on circles that share the screen corners' centres.

WidgetGauge is a progressbar ring that fills clockwise from the top and eases between reports, so a stepped feed reads as one calm sweep; at 100 its number gives way to a check. WidgetProgress is the task, "Step 3 of 5" with what it is doing, and a 4 px bar whose fill slides in from the start side so its rounded end keeps its shape. WidgetList takes done, the count finished from the top: their checks fill in order and dim, and the next line is half drawn. Every live figure is tabular and counts sit at the end of their line, so a number that gains a digit never moves its neighbours. Lines that change fade out and back in within one footprint with WidgetSwap, so two texts never show through each other; when the inline line changes width, the centred date line glides to its new place. Pass announce to say a result politely when it lands rather than on every tick. Under reduced motion the values still change; the ring and bar jump and only the fades stay.

Examples

States

Every size on the wallpaper, a home screen with a medium and a small widget, the lock screen when done, a large widget with a list, tinted and dark.

Every size, a home screen with a medium and a small widget, the lock screen when done, a large widget with a list, tinted and dark.

Props

PartPropsNotes
HomeWidgetsize, tone, label, announcesmall | medium | large | inline | circular | rectangular; tinted is a muted fill
HomeScreenwidgets, apps, dock, search, rowsWidgets take { id, size, label, content, col?, row?, tone? }
LockScreendate, time, inline, widgets, controlsUp to four slots under the clock
WidgetGaugevalue, label, size, stroke, caption0 to 100; default 72 and 6
WidgetProgresstitle, step, steps, detail, value, childrenvalue 0 to 1, default step / steps; children are a muted note under the title
WidgetListitems, doneStrings or { id, text }
WidgetLabel, WidgetSwapicon; idThe top line; a crossfade keyed by id