Give your AI assistant deep knowledge of hyuskui components, the CLI and GPUI patterns.
Skills give AI assistants such as Claude Code, Cursor and Codex project-aware context about hyuskui. Once installed, your assistant knows how to find, install, compose and theme components in a GPUI app. For example, you can ask it to:
- Add a settings dialog with a name input and a save button.
- Show a sheet with filters when I click the toolbar button.
- Make an area chart of daily visitors with a gradient.
- Switch the app to the dark theme.
The assistant uses the hyuskui CLI and the patterns below instead of guessing at GPUI APIs or writing components from scratch.
Install
This installs the skill for the assistants you choose. They load it automatically when you work with hyuskui. See skills.sh for more about skills.
For Claude Code, save the file as ~/.claude/skills/hyuskui/SKILL.md, or as .claude/skills/hyuskui/SKILL.md in a single project:
---
name: hyuskui
description: Build GPUI (Zed's Rust UI framework) interfaces with hyuskui components. Use when adding, using, styling or theming hyuskui components in a Rust GPUI app, when running the hyuskui CLI (init, add, list, diff), or when a project has src/theme.rs and src/ui/mod.rs from hyuskui.
---
# hyuskui
hyuskui is a set of copy-paste UI components for GPUI, in the spirit of shadcn/ui. The CLI copies each component's Rust source into the user's project. The code is then theirs to read and edit. There is no hyuskui library dependency to upgrade.
Docs: https://ui.hyuskui.com/docs. Every component's source, API and examples: `https://ui.hyuskui.com/r/<name>.json`.
## Project context
Before writing UI code, check the project:
1. `Cargo.toml` depends on `gpui` and `gpui_platform` from git, pinned to the Zed commit hyuskui is tested against:
```toml
gpui = { git = "https://github.com/zed-industries/zed", rev = "a36d4850f3c087bfef8a3552e2e15d72d97efdf4" }
gpui_platform = { git = "https://github.com/zed-industries/zed", rev = "a36d4850f3c087bfef8a3552e2e15d72d97efdf4" }
```
`rust-toolchain.toml` pins the Rust version Zed builds with (`channel = "1.100.0"`). The crates.io release of GPUI is older, and the components don't build against it.
2. `src/theme.rs` holds the design tokens. `theme::init(cx)` must run once at startup, before the first window opens.
3. `src/ui/mod.rs` declares one `pub mod` per installed component. Read it to see what's installed. Don't assume a component exists.
4. `main.rs` (or `lib.rs`) declares `mod theme;` and `mod ui;`.
If `src/theme.rs` is missing, run `cargo hyuskui init` first.
## CLI
Run it from anywhere inside the project. It finds the nearest `Cargo.toml`.
| Command | What it does |
|---|---|
| `cargo hyuskui init` | Writes `src/theme.rs`, creates `src/ui/mod.rs`, and declares both modules. |
| `cargo hyuskui add <name...>` | Copies components into `src/ui/` with what they depend on, and registers them in `mod.rs`. Runs `init` if needed. `--all` adds everything. `--overwrite` replaces existing files. |
| `cargo hyuskui list` | Lists every component. |
| `cargo hyuskui diff <name>` | Shows how the local copy differs from the registry. |
Use `cargo hyuskui add` instead of writing a component from scratch. Without `--overwrite`, it never touches a file the user has edited. Run `diff` before overwriting, so the user's changes aren't lost.
## Using components
```rust
use crate::theme::ActiveTheme;
use crate::ui::button::{Button, ButtonVariant};
Button::new("save", "Save").variant(ButtonVariant::Outline).on_click(|_, _, cx| { /* ... */ })
```
Patterns all components follow:
- **Builders.** `Component::new(id, ...)` followed by chained setters. Most are `RenderOnce` elements that you pass to `.child(...)`.
- **Ids.** Anything interactive takes an `id` (`impl Into<ElementId>`) that must be unique among its siblings. In lists, use tuples such as `("row", ix)`.
- **Controlled state.** Your view owns the state, and the component reports changes. Open/closed, the selected value and the checked state are passed in, and you update them in a handler:
```rust
Dialog::new("publish", self.open)
.trigger(Button::new("open", "Publish"))
.title("Publish v1.4.0")
.on_open_change(cx.listener(|this, open: &bool, _, cx| {
this.open = *open;
cx.notify();
}))
```
The same shape applies to `Select` (`value`, `open`, `on_change`, `on_open_change`), `Sheet`, `Drawer`, `AlertDialog` and `Popover` (`open`, `on_open_change`), `Tabs` (`selected`, `on_select`), and `Checkbox` and `Switch` (`checked`/`on`, `on_toggle`). Always call `cx.notify()` after changing the state.
- **Text inputs are entities.** `TextInput` keeps its text, selection and IME state, so you create it once and store it:
```rust
let email = cx.new(|cx| TextInput::new(cx).placeholder("Email"));
```
Store the `Entity<TextInput>` on your view and render it directly with `.child(self.email.clone())`. Read it with `email.read(cx).text()`, or subscribe to `InputEvent::Change` / `InputEvent::Submit`. Use `InputGroup::new(entity)` to add icons or buttons around it.
- **Toasts.** Render `Toaster::new()` once at the root of the window. Then call `toast(Toast::new("Saved"), cx)` from anywhere.
- **Overlays.** Dialogs, sheets, drawers and menus are rendered inline, where they're used. They use GPUI's `deferred` to draw above the rest of the window, so you don't need to add them to a portal or root layer.
## Theming
Colors and radius come from `cx.theme()`, which returns `&Theme`. These tokens mirror shadcn's: `background`, `foreground`, `card`, `card_foreground`, `muted`, `muted_foreground`, `primary`, `primary_foreground`, `secondary`, `secondary_foreground`, `accent`, `accent_foreground`, `destructive`, `destructive_foreground`, `border`, `input`, `ring` and `radius`.
- Style your own UI with tokens, not literal colors: `.bg(theme.card).border_color(theme.border).text_color(theme.muted_foreground)`.
- Use `Theme::light()` and `Theme::dark()` for the two built-in themes. To switch at runtime, call `cx.set_global(Theme::dark())` and then `cx.refresh_windows()`.
- To restyle everything, edit `src/theme.rs`. Make component-specific changes in that component's file under `src/ui/`.
- If you need to clone the theme so `cx` can be borrowed mutably (for example to build listeners), use `let theme = cx.theme().clone();`.
## Icons
Icons live in `src/icons.rs` (`cargo hyuskui add icons`, and installed automatically with any component that draws one). Each is a constant of SVG bytes, named after its Lucide name in SCREAMING_SNAKE_CASE: `SEARCH`, `CHEVRON_DOWN`, `SETTINGS_2`. Brand marks are `APPLE`, `GOOGLE`, `GITHUB` and `META`.
```rust
use crate::icons::{icon, SEARCH};
icon(SEARCH).text_color(theme.muted_foreground) // 16px, tinted with the text color
```
Don't paste SVG strings into components. If an icon is missing, add one line to the `lucide!` list in `src/icons.rs`: the name, then the markup between `<svg ...>` and `</svg>` from lucide.dev. The full list is at https://ui.hyuskui.com/docs/icons.
## Charts
`cargo hyuskui add chart` adds `Chart` (bar, line and area), `PieChart`, `RadarChart` and `RadialChart`. They're drawn natively, with no JavaScript. There are 65 ready-made examples at https://ui.hyuskui.com/charts/area: open one and copy its code.
```rust
Chart::new("visitors", ChartKind::Area)
.categories(["Jan", "Feb", "Mar"])
.series(ChartSeries::new("Desktop", [186.0, 305.0, 237.0]))
.gradient(true)
```
## Components
- `button`: A clickable control with five variants and three sizes.
- `badge`: A small status label.
- `card`: A bordered surface with an optional header and footer.
- `alert`: A callout that draws attention to a message.
- `checkbox`: A controlled checkbox with an optional label.
- `switch`: An on/off toggle.
- `tabs`: A segmented list for switching between panels.
- `avatar`: A round image that falls back to initials.
- `separator`: A thin horizontal or vertical rule.
- `kbd`: A keyboard shortcut hint.
- `accordion`: A stack of collapsible sections whose open items are owned by the parent view.
- `collapsible`: A section with a clickable trigger that shows or hides extra content.
- `aspect_ratio`: Keeps its content at a fixed width-to-height ratio.
- `breadcrumb`: A trail of links to the current page, with an optional ellipsis for collapsed levels.
- `empty`: A placeholder for views with nothing to show yet, with media, text and actions.
- `item`: A list row with media, a title, a description and actions.
- `label`: Text that names a form control.
- `typography`: Headings, paragraphs, quotes, lists and other text styles for prose.
- `table`: A static data table with a header, body rows, an optional footer and caption.
- `skeleton`: A pulsing placeholder block shown while content loads.
- `button_group`: Related actions joined into one control with shared borders and square inner corners.
- `toggle`: A two-state button that can be on or off.
- `toggle_group`: A set of joined toggles with single or multiple selection.
- `radio_group`: A set of mutually exclusive options where only one can be selected.
- `slider`: Pick a value from a range by dragging the thumb, clicking the track, or using the arrow keys.
- `progress`: A bar showing how far a task has completed.
- `spinner`: A rotating indicator for work in progress.
- `pagination`: Page navigation with previous and next links and collapsed page ranges.
- `input`: A text field with IME composition, selection, clipboard and a blinking cursor.
- `textarea`: A multi-line text field that wraps and grows with its content.
- `field`: Lays out a label, a control, helper text and an error message.
- `form`: Typed form state with a zod-like schema, validation modes, field bindings and async submit actions.
- `onchain`: EIP-55 addresses, decimal-aware token amounts in integer base units, and basis-point math for rates, slippage, vault shares and health factors.
- `input_group`: A text input with leading and trailing addons inside one border.
- `input_otp`: One-time-code slots that auto-advance and accept a pasted code.
- `popover`: Floating content anchored to a trigger that closes on outside click or Escape.
- `dialog`: A centered window over a dimmed page, closed by its × button, Escape or an outside click.
- `alert_dialog`: A modal that asks the user to confirm or cancel an important action.
- `sheet`: A panel that slides in from any edge of the window.
- `drawer`: A bottom sheet with a grab handle and centered content.
- `dropdown_menu`: A menu of actions that opens from a trigger.
- `context_menu`: A menu that opens at the pointer on right-click.
- `tooltip`: A short label shown beside an element while it is hovered.
- `hover_card`: A preview card shown while the pointer rests on a trigger.
- `toast`: Brief notifications that stack in the corner and dismiss themselves.
- `command`: A search box over a grouped list of actions, with arrow-key highlight and Enter to run, inline or as a dialog.
- `combobox`: A select whose list has a search box to filter the options.
- `select`: A trigger showing the chosen value that opens a list of options, with groups, separators and keyboard navigation.
- `calendar`: A month grid for picking a single date or a date range.
- `date_picker`: A button showing the chosen date that opens a calendar in a popover.
- `carousel`: A horizontal track of slides with previous/next buttons and optional dot indicators.
- `code_block`: A framed monospace code block with syntax highlighting, an optional filename header, line numbers and a copy button.
- `scroll_area`: A scrolling region with thin, draggable overlay scrollbars.
- `resizable`: Panels split horizontally or vertically by draggable dividers, with sizes in percent.
- `menubar`: A horizontal bar of menus where hovering another trigger switches the open menu.
- `navigation_menu`: Site navigation links whose triggers open content panels on hover or click.
- `sidebar`: An app sidebar with a header, labelled groups of menu buttons and a footer that collapses to icons.
- `chart`: Bar, line and area charts with axes, gridlines, a legend and a hover tooltip, drawn natively.
- `data_table`: A table with sortable columns, a text filter, row selection and pagination, generic over the row type.
- `marker`: An inline status, system note or labeled separator in a conversation.
- `bubble`: A framed message surface with variants, alignment, grouping and reactions.
- `message`: One message in a conversation, with optional avatar, header, footer and alignment.
- `attachment`: A file or image attachment with media, name, metadata, upload state and actions.
- `trace`: A list of steps such as an agent's searches, tool calls and edits, with status and expandable detail.
- `message_scroller`: A chat transcript that sticks to the newest message unless the reader scrolls up.
- `questionnaire`: A multi-step form with single-choice, multiple-choice, freeform and skippable questions.
## Rules
- Check `src/ui/mod.rs` before importing a component. If it's missing, `cargo hyuskui add` it instead of writing a substitute.
- Components are the user's code. When a component can't do what's needed, edit its file in `src/ui/`. Don't wrap it in layers of workarounds.
- Keep the GPUI rev in `Cargo.toml` at the one shown above unless the user asks to change it. Components are only tested against that commit.
- For a component's full API, fetch `https://ui.hyuskui.com/r/<name>.json`. Its `api` field lists the builder methods, and `examples` holds working code.What's Included
The skill gives your assistant knowledge of:
Project Context
Checks that gpui is pinned to the tested Zed commit, which components are listed in src/ui/mod.rs, and that theme::init runs at startup, before it writes any UI code.
CLI Commands
When to run cargo hyuskui init, add, list and diff, and to run diff before --overwrite so your edits aren't lost.
Component Patterns
Builders with unique ids. Controlled state, where your view owns open and selected and handles on_open_change. Text inputs as entities. A single Toaster. Overlays that need no portal.
Theming
The theme tokens, styling with cx.theme() instead of hard-coded colors, switching between light and dark, and where to make changes.
Charts
Chart, PieChart, RadarChart and RadialChart, and where to find the 65 examples in the charts gallery.
Component Index
Every component in the registry, with a description. This list is regenerated on every release of this site, so it's never out of date.
How It Works
- Project detection. The skill activates in a Rust project that uses GPUI, or that has
src/theme.rsandsrc/ui/mod.rsfrom hyuskui. - Context check. Before writing code, the assistant reads
Cargo.tomlandsrc/ui/mod.rsto see the GPUI version and which components are installed. - Install, don't invent. If a component is missing, the assistant runs
cargo hyuskui addrather than writing a substitute. - Full API on demand. For a component's builder methods and working examples, it fetches
/r/<name>.jsonfrom this site.
Learn More
- CLI: every command and flag
- Theming: tokens, and light and dark themes
- Components: every component with previews and code
- skills.sh: the open skills directory and CLI