Read This First
Before changing UI, interaction, interface language, layout, styling,
components, or application architecture, read the relevant guide:
| Guide | Read before |
|---|
| Design Guides | Choosing components, layout, spacing, hierarchy, color, density, interaction states, overlays, interface copy |
| Coding Guides | Crate layering, vs , state ownership, , focus, async, public API, testing |
These guides are requirements, not optional inspiration. Do not copy generic
web conventions, infer a design system from one existing screen, or add a
control merely because the underlying feature exists. Review the finished work
against both guides before considering it complete.
Read the guide file itself. Do not answer from what this page summarizes, from
an existing screen in the codebase, or from training data — those are the three
ways the guides get quietly ignored.
Non-negotiables
These are a floor, not a substitute. Read the guide for anything past this list.
- Never invent an API. Search the current source for the real signature.
Do not translate a React, CSS, or older-GPUI example by analogy — a
plausible-looking method name that does not exist is the most common
failure mode here.
- Desktop before web convention. Keyboard access, window chrome, menus,
dense data views, resizable regions, persistent navigation.
- vs . for every in-app command — use or
when it should read quietly. only for external URLs and
email addresses.
- Tokens before values. No raw hex or in application UI; use
semantic tokens. Use rem-based helpers (, ,
) so window zoom works. Any spacing number you see quoted is the
current default scale, not a literal to repeat.
- State must be visible. Hover, focus, selection, disabled, loading,
validation, and destructive states each need distinct, consistent treatment.
- Stable identity. Repeated elements need domain-derived s, not
list indexes.
- Overlays. Escape dismisses the topmost surface and returns focus to its
trigger.
- Copy. Name the object and the verb — with a
button, not with .
Documentation
- Full reference: fetch
https://longbridge.github.io/gpui-component/llms-full.txt
- Per-component API: fetch
https://longbridge.github.io/gpui-component/docs/components/{name}.md
- Any site page can be fetched as Markdown by appending to the URL
Quick Reference
Setup — always required:
rust
gpui_component::init(cx); // in app.run(), must be first
Root::new(view, window, cx) // first-level view in every window
Stateless — use directly in render:
rust
Button::new("id").primary().label("OK").on_click(|_, _, _| {})
Stateful — hold
in struct, pass ref in render:
rust
// in new(): let input = cx.new(|cx| InputState::new(window, cx));
// in render: Input::new(&self.input)
Component Catalog
When you need a component, find it here. For full API, fetch its
doc.
Input & Form
| Component | Import | Notes |
|---|
| input::{Input, InputState}
| Stateful. Text, password, mask, validation |
| input::{NumberInput, NumberInputEvent}
| Stateful. Numeric with step |
| | Stateful. One-time password |
| select::{Select, SelectState}
| Stateful. Dropdown picker |
| combobox::{Combobox, ComboboxState}
| Stateful. Searchable select |
| | Stateless. `on_click( |
| | Stateless. Toggle |
| radio::{Radio, RadioGroup}
| Stateless. |
| slider::{Slider, SliderState}
| Stateful. |
| | Stateless. |
| | Stateless. |
| | Stateless. Increment/decrement |
| color_picker::{ColorPicker, ColorPickerState}
| Stateful. |
| date_picker::{DatePicker, DatePickerState}
| Stateful. |
| form::{v_form, h_form, field}
| Layout container for form fields |
Display & Feedback
| Component | Import | Notes |
|---|
| button::{Button, ButtonGroup}
| Stateless. Primary UI action |
| | Stateless. Lucide icons |
| | Stateless. |
| | Stateless. Closable tags |
| | Stateless. |
| | Stateless. Form label |
| | Stateless. Keyboard key display |
| | Stateless. Info/success/warning/error |
| | Stateless. Loading indicator |
| | Stateless. Loading placeholder |
| progress::{Progress, ProgressCircle}
| Stateless. |
| | Via on elements |
| hover_card::{HoverCard, HoverCardState}
| Stateful. |
| | Stateless. Copy button |
Overlay & Popups
| Component | Import | Notes |
|---|
| + | Via |
| | Via window.open_alert_dialog(...)
|
| + | Side panel, via |
| notification::Notification
+ | Via window.push_notification(...)
|
| | Floating overlay |
| menu::{PopupMenu, DropdownMenu}
| Context menus |
| | Button with dropdown menu |
Navigation & Layout
| Component | Import | Notes |
|---|
| / | | Tabbed interface |
| sidebar::{Sidebar, SidebarMenu, ...}
| App navigation panel |
| | Window title bar |
| | Navigation breadcrumb |
| | Page navigation |
| | Collapsible sections |
| | Single collapsible |
| | Labeled container |
| resizable::{h_resizable, v_resizable, resizable_panel, ResizableState}
| Draggable split panes |
| | Custom scrollbar |
| gpui_base::focus_trap::FocusTrapElement
| Keyboard trap for modals |
Data Display
| Component | Import | Notes |
|---|
| table::{DataTable, TableState, TableDelegate}
| Stateful. Full-featured table |
| | Simpler table |
| {v_virtual_list, h_virtual_list}
| High-perf large lists |
| list::{List, ListState, ListDelegate}
| Stateful. Searchable list |
| tree::{Tree, TreeState, TreeItem, TreeEntry}
| Stateful. Hierarchy |
| description_list::DescriptionList
| Key-value pairs |
| | Settings panel |
Charts
| Component | Import | Notes |
|---|
| chart::{AreaChart, BarChart, LineChart, PieChart, RadarChart}
| Bar, line, area, pie charts |
| | for data |
Reference Files
- usage.md — setup patterns, component types, common examples
- style-guide.md — code style for contributors