GPUI Deck

Copy recipes

These 23 catalogue recipes are reusable application source, used by the native two-style example and catalogue example.

These 23 catalogue recipes are reusable application source, used by the native two-style example and catalogue example. Button and Chart also have presentation recipes for their public controls. They compose GPUI layout with the existing controls and keep colors, spacing, and sizing in the consumer's Palette or application-supplied Styled values.

Copy into an application

The source CLI copies a recipe with its transitive recipe dependencies, light/dark token source, module declarations, license and required assets:

cargo run -p gpui-deck-cli --locked -- list
cargo run -p gpui-deck-cli --locked -- add data-table avatar --to ../my-app/src/ui

Declare mod ui; in the consumer and use ui::recipes::{DataTable, Avatar} and ui::Appearance::Settings.palette() or ui::Appearance::Compact.palette(). Use the matching Cargo dependencies in the installation guide. The CLI does not change the consumer's manifest. It embeds the repository's current recipe source when built; there is no remote registry or update service.

Keep this feature declaration in the consumer manifest:

[features]
test-support = ["gpui-deck/test-support"]

Copied recipe tests are guarded by this consumer feature. Declaring it also makes their cfg values known to Rust; enable it to run the existing GPUI tests.

Run add again with more names to extend the same directory. Existing recipe and palette edits are preserved. Generated mod.rs declarations and recipes/.gpui-deck track the installed set; if those scaffolds were edited, the CLI stops before writing and explains how to add declarations manually. Conflicting new files are also rejected. The copied source belongs to the application.

Use diff after updating your checkout to compare the installation with the current CLI's bundled sources. Git must be on PATH. The command reads the installed recipe manifest and reports changes to managed files, including missing files. In each patch, - lines are from your app and + lines are from the CLI. It leaves the app unchanged.

cargo run -p gpui-deck-cli --locked -- diff --to ../my-app/src/ui

To copy manually:

  1. Copy the desired files from crates/base/examples/recipes into an application module, preserving the repository's license terms.

  2. Declare the copied modules and re-export the types, following the small mod.rs. Copy only the modules needed by the application and list only those modules.

  3. Copy presentation.rs beside the application's recipes directory. It contains the actual Palette and both appearances used by the tested example, without the Demo or its behavior. Declare it and expose its tokens in the recipes' parent module:

    mod presentation;
    pub(crate) use presentation::{Appearance, Palette};
    mod recipes;

    Choose Appearance::Settings.palette() or Appearance::Compact.palette() in the application view. Recipe imports such as use super::super::Palette work directly. Change the copied token values to fit the application, or replace Palette with an existing token type. AspectRatio takes no palette; its consumer supplies the visual style. Bubble and Chart currently keep their own copyable styling.

  4. Import the types from that application module. They use pub(crate) visibility and are not exported from gpui_deck. No extra dependency is required.

The palette module and recipes are application source, outside the library exports. The CLI provides local source distribution; these visual tokens do not install a global theme provider. The library continues to own interactive behavior.

Some recipes compose other recipe modules. Copy those modules and their re-exports alongside the desired recipe:

RecipeOther recipe modules required
DataTableInputGroup, EmptyState, and Pagination
MessageTypography (Paragraph)
SidebarSheet
TraceTypography (Paragraph)

Verification scope

The existing composition suite runs the same recipe modules as the native example. Its command-search flow covers empty-state recovery, and its date-picker flow covers traversal and activation of the grouped month buttons. Static shapes and palette values have no separate test suite. The existing field/preset flow covers missing-name recovery, the disabled addon for a read-only input, urgent inline semantics, and the Item's retained preview/edit behavior. The date-picker flow also checks that the ordinary schedule notice remains a Note. The existing three-platform CI continues to check real consumer composition and native compilation. Linux additionally runs isolated recipe tests. Windows and macOS filter the two_styles::recipes:: tests from the same composition target, keeping the real application flows while avoiding repeated recipe-only checks. One additional composed flow covers the preset table's sorting, filter/empty recovery, page boundaries, stable-ID action, and retained choice. There is no separate data test framework or duplicated platform-specific flow. These results do not establish native screen-reader, IME, visual, or performance validation.

The existing preview flow also covers named Spinner rendering, a decorative non-focusable Skeleton, GPUI reduced-motion rendering, reset cancellation, restoring the percentage fill, and removing the indicators when their disclosure closes. The loading recipes add no test function or CI job; animation scheduling remains GPUI's responsibility rather than a second test controller here.

The existing Help flow checks Kbd's readable symbolic key name and absence of new focus stops, alongside the composed Breadcrumb ancestor actions. The context-menu flow exercises the existing shortcut displayed by its keycaps. There is no separate keybinding test controller, palette suite, or CI job for these static key hints. Native screen-reader speech and desktop visual rendering remain separate validation work.

The media recipes add two focused regressions within the same composition target. Avatar exercises absent, pending, failed, loaded, and cleared image sources while checking its native name, focus neutrality, and fixed geometry; the loaded path decodes the bundled SVG. AspectRatio exercises two container widths, oversized content, and pointer clipping beyond the frame. The existing preset flow checks that the retained choice drives the preview's artwork, frame ratio, and session name while preserving the existing trigger and dismissal behavior. These checks do not establish remote image transport, native screen-reader speech, desktop visual rendering, or performance measurements.

Sheet coverage exercises edge placement, normal and narrow viewport widths, fixed header/footer geometry, body scrolling, descendant focus reveal, and closing and reopening with retained form state. The checks also exercise the shared Dialog's backdrop wheel handling to keep underlying content from scrolling, and opens Select in a narrow window to check the child popup's horizontal bounds. Nested-modal checks cover focus containment and wheel isolation in the top dialog, closing it while the Sheet remains open, and returning through the Sheet to its original trigger. These are layout and interaction checks in the existing GPUI test contexts; their scope does not establish native screen-reader, platform IME, or desktop visual validation.

Typography checks cover native heading levels independently of visual size, complete accessible names, Paragraph and Code roles, and the absence of text focus stops. Layout coverage uses long text and code with both appearances at normal and narrow widths. The Help consumer preserves its existing hierarchy, ancestor actions, and keyboard traversal. The composition target is also run with a 1.5 MiB test-thread stack to check the example's render-stack regression. These are native metadata, layout, and simulated-input checks; screen-reader speech, platform IME behavior, and desktop visual results require separate validation.

Sidebar is exercised in the Settings consumer's existing composition flows; there is no separate candidate fixture. The flows check explicit activation, disabled entries, current-section semantics, retained values, ordinary focus traversal, and the stacked narrow-window layout. Compact's TabList behavior remains covered by its real consumer flows. Button's native metadata contract owns current-page checks, and TabsState's core regression owns focus-neutral programmatic selection and change events.

Code Block coverage checks empty and multiline content, Unicode, complete code names, preserved line endings, and exact full-text copying through GPUI's test clipboard. Layout checks exercise both appearances, narrow widths, long lines, and long bodies. The consumer flow verifies current settings in the copied JSON, keyboard entry and traversal, code-scroll ends, and isolation from the parent Sheet's scroll range. Clipboard assertions run only in the test platform and do not exercise the user's desktop clipboard service. The composition target also retains the 1.5 MiB stack check; native clipboard integration, screen-reader speech, IME, and desktop visual observations remain separate validation work.

Marker coverage checks a single meaningful label, decorative separator omission, and normal focus traversal past the marker. Layout checks exercise long Korean and English labels, narrow widths, and both appearances. Schedule checks distinguish the current selected date from a moved or cancelled calendar cursor, preserve the existing keyboard flow, and update the boundary when the selection changes or clears. These are metadata, layout, and simulated-input checks; native screen-reader speech, IME, DPI, and desktop visual observations remain separate validation work.

Message's focused recipe check covers the Comment/Label/Paragraph hierarchy, each supplied text's accessible name appearing once, explicit line breaks, long Korean and English content, and narrow-width wrapping in both appearances. Button's own tests cover activation and disabled behavior. The Schedule consumer checks the shared note value, local edit metadata, empty-state transitions, Edit note focus, and existing Sheet scrolling and dismissal. These are headless metadata, layout, and input checks; native screen-reader speech and desktop visual validation remain separate.

Attachment's focused recipe check covers the full filename name and combined metadata description without duplicate child semantics, long Korean and English filenames, narrow-width wrapping, and both appearances. Supplied actions retain Button's independently tested activation and disabled behavior. The Help consumer checks that the byte count follows the current UTF-8 JSON, Inspect JSON reaches the existing code focus target, and CodeBlock keeps its complete copy and scrolling behavior. Clipboard assertions remain limited to GPUI's test clipboard; native file access, screen-reader speech, and desktop visual observations are not established by these checks.

Trace's focused recipe check covers summary naming, expanded metadata, the named Region and Paragraph hierarchy, closed-content removal, and long summaries and details wrapping at narrow widths in both appearances. Collapsible's core tests own activation, disabled-trigger behavior, and focus return on closure; supplied actions use the existing Button contract. The Help consumer checks current form values, disclosure retention, the Close details action, and surrounding Sheet scrolling and focus. The composition target retains its 1.5 MiB stack check. These tests exercise native metadata, layout, and simulated input; desktop rendering, screen-reader speech, IME, and performance still require separate validation.