The preview

Docs

The preview renders the real component kit from your tokens, in the view, device and theme you pick. What you see is what designsource add installs and what the exports describe.

The preview in the phone frame, the landing sample laid out at 393 pixels under the status bar

How to use it

Views. The picker lists Custom (your generated page, when the project has one), Components (the gallery), Blocks and five sample pages: Landing, Dashboard, Blog, Booking, Arcade. A project opens on Landing, or on Custom when it was created with a generated page.

Photos and video. The sample pages and the Custom page draw real photos from Unsplash, credited at the bottom of the page ("Photos from Unsplash", then each photographer by name, each a link that opens Unsplash in a new tab). The landing hero can play a muted looping video, one of eight loops hosted by us, with a button in its corner that pauses it; it holds still under reduced motion and in the corner thumbnail. Icons come from the project's icon set, a person who is named gets an initials avatar rather than a photo, and an image slot (a cover, hero or gallery tile) without a photo shows art painted from your tokens. When the AI writes a Custom page it also picks the photos, searching Unsplash for the product, an optional hero video from the eight loops, and the icons. Photos found for earlier pages are reused when they match, and a slot that neither those nor a search can fill (no search key, or a slow or rate limited search) shows that art instead.

Gallery focus. On Components, a second picker shows one component instead of all 60, grouped under Forms and inputs, Overlays, Navigation, Layout, Data and feedback, Chat.

Blocks. On Blocks, a picker chooses one of the 34 page blocks: logins, signups, sidebars, a dashboard and chart groups, each painted in your tokens. See Blocks.

Devices. Mobile (393 wide), Tablet (820) or Desktop. On a window under 640 pixels wide the picker is hidden and the page fills the panel unframed. The phone and tablet draw a bezel with a status bar and home strip in your theme; the page gets only the space between them.

Both themes. The Columns2 toggle shows light and dark side by side; each frame wears a small sun or moon chip in its corner. In single view the corner thumbnail shows the other theme, scaled from a page laid out at the device's width; click it to swap.

Full page. View full page fills the window; Escape or the button returns.

How it works

The frame is a container the kit's responsive classes query (stage), so a phone frame in a desktop window stacks a dialog's footer and turns the sidebar into a sheet, and a block that opens a dialog portals it into the frame rather than over the app. Overlays inside the preview are non-modal, so a block's open dialog never freezes the workbench. Every mounted copy of a block, in split mode and in the thumbnail, scopes its ids, so a chart gradient in the dark frame is its own.

The selected view, device, focus and block are the workbench's state and survive a project switch (the view resets on mount only). A view whose page disappears (a generation that failed) falls back to Landing.

Both frames read the same overlay of unsaved edits. The theme the thumbnail shows is also what the add-token dialog's unpinned swatches use; the score and the checks grade both themes regardless.

The thumbnail hides under 22rem of preview width (a phone), where it would cover the page it exists to keep honest; a moon button in the preview header takes its place there and swaps the theme the same way, pressed while dark is showing. On those narrow widths the pickers also drop their arrows so the row fits; the device picker folds into one dropdown under 40rem; the focus picker and the view picker drop their words on the rungs below.

Gradients in the preview. A project's gradients show on the surfaces that point at them: the default button and badge (the primary or accent gradient), the card (the page wash), and on pages the call-to-action band (the primary gradient) and the hero (the page wash). Each lies over the surface's solid colour, so a surface painted with a fill of its own shows that fill instead.

What can go wrong

  • Custom is missing: the project has no generated page, or its stored page is of an older shape. The workbench still works; the page is simply not offered.
  • A block stays on its spinner: the block's chunk is still loading; it is fetched only when picked.