Write native GPUIdesktop views with RSX.
Structure desktop views with clean tags and utility classes while keeping state, loops, and type checking in idiomatic Rust. Static RSX expands directly into GPUI builder calls at compile time.
rsx! { <div class="flex flex-col gap-[12px] p-[24px]"> <h1 class="text-xl font-bold">{"Hello, GPUI"}</h1> <p class="text-gray-500">{"Native Rust UI"}</p> <Button("save") label="Save" primary /> </div>}div() .flex() .flex_col() .gap(px(12.0)) .p(px(24.0)) .child(div().text_xl().font_bold().child("Hello, GPUI")) .child(div().text_color(rgb(0x6b7280)).child("Native Rust UI")) .child(Button::new("save").label("Save").primary())Structured from first window to production architecture: master core syntax and styling first, then layer in theming, components, and tooling.
Foundations & Core Syntax
Configure GPUI Kit, learn how RSX expands at compile time, and master utility classes and stateful IDs.
Getting Started
Add dependencies, configure gpui_kit, and render your first native window.
Compatibility
Verify Rust toolchain requirements, GPUI Kit 0.10.0 pins, and crate features.
RSX Syntax Reference
Constructor shorthand, named slots, event handlers, and uniform_list virtualization.
Class Handling & Variants
Compile-time utility expansion, conditional arrays, hover/focus variants, and dynamic limits.
IDs & Stateful Elements
Understand when Stateful IDs are required and how nested interactive nodes are keyed.
API Reference
Single-page lookup for every macro, attribute mapping, event alias, and utility table.
Theming, Components & Tooling
Wire up design tokens, integrate gpui-component widgets, and set up LSP and hot-reload workflows.
Theming & Design Tokens
Declare colors, typography, and spacing scales in rsx.toml with compile-time validation.
GPUI Component Guide
Compose native Button, Input, and Select widgets cleanly with RSX slots.
CLI & Editor Tooling
Configure LSP diagnostics, RSX formatting, JSX migration, and cargo rsx dev.
Best Practices
Split views by workflow, scope redraws cleanly, and structure maintainable desktop apps.
Performance, Upgrades & Demos
Eliminate runtime overhead, upgrade smoothly across versions, and study runnable native binaries.
Performance Guide
Keep classes static, avoid dynamic matcher fallbacks, and virtualize long queues.
Migration Guide
Move to GPUI Kit 0.10.0, adopt Tailwind 4px spacing, and update macro calls.
Troubleshooting
Resolve macro errors, missing trait imports, ID collisions, and hot-patch issues.
Runnable Demos
Run ten native GPUI binaries shipped in the workspace, from counters to consoles.
Incident Console
A modular native GPUI application shipped in the repo—demonstrating multi-pane layouts, 100k-row uniform_list virtualization, rsx.toml tokens, and live timelines.
Choose the Right Macro
Numeric spacing defaults to pixels (gap-4 = 4px). Opt into Tailwind’s 4px scale with rsx_tw! or globally via rsx.toml.
rsx!- Default permissive mode for gradual adoption and everyday views.
rsx_strict!- Rejects unknown static utility classes at compile time.
rsx_tw!- Enables Tailwind 4px spacing units (gap-4 → 16px).
rsx_fragment!- Returns Vec<AnyElement> for heterogeneous root nodes.
rsx_listener!- Wraps cx.listener with an optional notify shorthand.
rsx_expand!- Returns generated Rust code as a string for inspection.
