### Declare widget examples in defineWidget manifest Source: https://glasshome.app/docs/widgets/widget-previews Adds an examples array to the manifest in defineWidget. Each entry contains a label, size in grid tiles, and a config that must satisfy the configSchema. The first example is used as the widget's thumbnail. Up to 20 examples are rendered; extras are ignored. ```TypeScript export default defineWidget({ manifest: { name: "Light", minSize: { w: 1, h: 1 }, maxSize: { w: 4, h: 4 }, sdkVersion: "^1.7.0", examples: [ { label: "Single light", size: { w: 2, h: 2 }, config: { title: "Reading Lamp", entityIds: ["light.bedroom_ceiling"] }, }, { label: "Room group", size: { w: 3, h: 2 }, config: { title: "Living Room", entityIds: ["light.living_room_main", "light.kitchen_counter"], }, }, ], }, configSchema, component: LightWidget, }); ``` -------------------------------- ### Install Playwright Chromium for widget preview Source: https://glasshome.app/docs/widgets/troubleshooting Run this command to install Playwright's Chromium browser, which is required for the `widget preview` command to start its browser. Use when the CLI reports it cannot start its browser. ```bash bunx playwright install chromium ``` -------------------------------- ### Preview a single widget Source: https://glasshome.app/docs/widgets/widget-previews Pass a widget name to render only that widget's examples. ```bash bun widget preview light ``` -------------------------------- ### Generate previews at custom sizes with bun widget preview Source: https://glasshome.app/docs/widgets/widget-previews Renders each example at the specified pixel sizes into `preview/sweep/`, producing a contact sheet per example and theme. The `grid` keyword covers common dashboard sizes, skipping heights not allowed by the manifest. ```bash bun widget preview light --sizes 150x156,340x242 --theme dark bun widget preview light --sizes grid ``` -------------------------------- ### Run widget preview Source: https://glasshome.app/docs/widgets/widget-previews Renders all widget examples locally, saving images to preview/ named -