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
- e.g.
button.md, input.md, select.md, dialog.md, data-table.md
- Any site page can be fetched as Markdown by appending
.md to the URL
Quick Reference
Setup — always required:
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:
Button::new("id").primary().label("OK").on_click(|_, _, _| {})
Stateful — hold Entity<State> in struct, pass ref in render:
// in new(): let input = cx.new(|cx| InputState::new(window, cx));
// in render: Input::new(&self.input)
Sizes: .xsmall() .small() .medium() (default) .large()
Theme: cx.theme().primary · .background · .foreground · .border · .muted
Component Catalog
When you need a component, find it here. For full API, fetch its .md doc.
Input & Form
| Component |
Import |
Notes |
Input |
input::{Input, InputState} |
Stateful. Text, password, mask, validation |
NumberInput |
number_input::{NumberInput, NumberInputState} |
Stateful. Numeric with step |
OtpInput |
otp_input::{OtpInput, OtpInputState} |
Stateful. One-time password |
Select |
select::{Select, SelectState} |
Stateful. Dropdown picker |
Combobox |
combobox::{Combobox, ComboboxState} |
Stateful. Searchable select |
Checkbox |
checkbox::Checkbox |
Stateless. `on_click( |
Switch |
switch::Switch |
Stateless. Toggle |
Radio |
radio::{Radio, RadioGroup} |
Stateless. |
Slider |
slider::{Slider, SliderState} |
Stateful. |
Toggle |
toggle::Toggle |
Stateless. |
Rating |
rating::Rating |
Stateless. |
Stepper |
stepper::Stepper |
Stateless. Increment/decrement |
ColorPicker |
color_picker::{ColorPicker, ColorPickerState} |
Stateful. |
DatePicker |
time::date_picker::{DatePicker, DatePickerState} |
Stateful. |
Form |
form::{v_form, h_form, field} |
Layout container for form fields |
Display & Feedback
| Component |
Import |
Notes |
Button |
button::{Button, ButtonGroup} |
Stateless. Primary UI action |
Icon |
{Icon, IconName} |
Stateless. Lucide icons |
Badge |
badge::Badge |
Stateless. |
Tag |
tag::Tag |
Stateless. Closable tags |
Avatar |
avatar::Avatar |
Stateless. |
Label |
label::Label |
Stateless. Form label |
Kbd |
kbd::Kbd |
Stateless. Keyboard key display |
Alert |
alert::Alert |
Stateless. Info/success/warning/error |
Spinner |
spinner::Spinner |
Stateless. Loading indicator |
Skeleton |
skeleton::Skeleton |
Stateless. Loading placeholder |
Progress |
progress::{ProgressBar, ProgressCircle} |
Stateless. |
Tooltip |
tooltip::Tooltip |
Via .tooltip() on elements |
HoverCard |
hover_card::{HoverCard, HoverCardState} |
Stateful. |
Image |
image::Image |
Stateless. |
Clipboard |
clipboard::Clipboard |
Stateless. Copy button |
Overlay & Popups
| Component |
Import |
Notes |
Dialog |
dialog::Dialog + WindowExt |
Via window.open_modal(...) |
AlertDialog |
WindowExt |
Via window.open_alert_dialog(...) |
Sheet |
sheet::Sheet + WindowExt |
Side panel, via window.open_sheet(...) |
Notification |
notification::Notification + WindowExt |
Via window.push_notification(...) |
Popover |
popover::Popover |
Floating overlay |
Menu |
menu::{PopupMenu, DropdownMenu} |
Context menus |
DropdownButton |
button::DropdownButton |
Button with dropdown menu |
Navigation & Layout
| Component |
Import |
Notes |
Tabs / TabBar |
tab::{Tab, TabBar} |
Tabbed interface |
Sidebar |
sidebar::{Sidebar, SidebarMenu, ...} |
App navigation panel |
TitleBar |
title_bar::TitleBar |
Window title bar |
Breadcrumb |
breadcrumb::Breadcrumb |
Navigation breadcrumb |
Pagination |
pagination::Pagination |
Page navigation |
Accordion |
accordion::Accordion |
Collapsible sections |
Collapsible |
collapsible::Collapsible |
Single collapsible |
GroupBox |
group_box::GroupBox |
Labeled container |
Resizable |
resizable::Resizable |
Draggable split panes |
Scrollable |
scroll::Scrollbar |
Custom scrollbar |
FocusTrap |
focus_trap::FocusTrap |
Keyboard trap for modals |
Data Display
| Component |
Import |
Notes |
DataTable |
table::{DataTable, TableState, TableDelegate} |
Stateful. Full-featured table |
Table |
table::{Table, ...} |
Simpler table |
VirtualList |
{v_virtual_list, h_virtual_list} |
High-perf large lists |
List |
list::{List, ListState, ListDelegate} |
Stateful. Searchable list |
Tree |
tree::{Tree, TreeState, TreeDelegate} |
Stateful. Hierarchy |
DescriptionList |
description_list::DescriptionList |
Key-value pairs |
Settings |
settings::Settings |
Settings panel |
Charts
| Component |
Import |
Notes |
Chart |
chart::Chart |
Bar, line, area, pie charts |
Plot |
plot::Plot |
#[derive(IntoPlot)] for data |
Reference Files
- usage.md — setup patterns, component types, common examples
- style-guide.md — code style for contributors
1---2name: gpui-component3description: How to use the gpui-component UI library in GPUI applications. Use when building UIs with gpui-component components (Button, Input, Select, Dialog, Tabs, Sidebar, List, Table, etc.), setting up the library, handling component state, theming, or finding the right component for a given UI need.4---56## Documentation78- **Full reference**: fetch `https://longbridge.github.io/gpui-component/llms-full.txt`9- **Per-component API**: fetch `https://longbridge.github.io/gpui-component/docs/components/{name}.md`10 - e.g. `button.md`, `input.md`, `select.md`, `dialog.md`, `data-table.md`11- **Any site page** can be fetched as Markdown by appending `.md` to the URL1213## Quick Reference1415**Setup** — always required:16```rust17gpui_component::init(cx); // in app.run(), must be first18Root::new(view, window, cx) // first-level view in every window19```2021**Stateless** — use directly in render:22```rust23Button::new("id").primary().label("OK").on_click(|_, _, _| {})24```2526**Stateful** — hold `Entity<State>` in struct, pass ref in render:27```rust28// in new(): let input = cx.new(|cx| InputState::new(window, cx));29// in render: Input::new(&self.input)30```3132**Sizes**: `.xsmall()` `.small()` `.medium()` (default) `.large()`3334**Theme**: `cx.theme().primary` · `.background` · `.foreground` · `.border` · `.muted`3536## Component Catalog3738When you need a component, find it here. For full API, fetch its `.md` doc.3940### Input & Form41| Component | Import | Notes |42|-----------|--------|-------|43| `Input` | `input::{Input, InputState}` | Stateful. Text, password, mask, validation |44| `NumberInput` | `number_input::{NumberInput, NumberInputState}` | Stateful. Numeric with step |45| `OtpInput` | `otp_input::{OtpInput, OtpInputState}` | Stateful. One-time password |46| `Select` | `select::{Select, SelectState}` | Stateful. Dropdown picker |47| `Combobox` | `combobox::{Combobox, ComboboxState}` | Stateful. Searchable select |48| `Checkbox` | `checkbox::Checkbox` | Stateless. `on_click(|&bool, ...|)` |49| `Switch` | `switch::Switch` | Stateless. Toggle |50| `Radio` | `radio::{Radio, RadioGroup}` | Stateless. |51| `Slider` | `slider::{Slider, SliderState}` | Stateful. |52| `Toggle` | `toggle::Toggle` | Stateless. |53| `Rating` | `rating::Rating` | Stateless. |54| `Stepper` | `stepper::Stepper` | Stateless. Increment/decrement |55| `ColorPicker` | `color_picker::{ColorPicker, ColorPickerState}` | Stateful. |56| `DatePicker` | `time::date_picker::{DatePicker, DatePickerState}` | Stateful. |57| `Form` | `form::{v_form, h_form, field}` | Layout container for form fields |5859### Display & Feedback60| Component | Import | Notes |61|-----------|--------|-------|62| `Button` | `button::{Button, ButtonGroup}` | Stateless. Primary UI action |63| `Icon` | `{Icon, IconName}` | Stateless. Lucide icons |64| `Badge` | `badge::Badge` | Stateless. |65| `Tag` | `tag::Tag` | Stateless. Closable tags |66| `Avatar` | `avatar::Avatar` | Stateless. |67| `Label` | `label::Label` | Stateless. Form label |68| `Kbd` | `kbd::Kbd` | Stateless. Keyboard key display |69| `Alert` | `alert::Alert` | Stateless. Info/success/warning/error |70| `Spinner` | `spinner::Spinner` | Stateless. Loading indicator |71| `Skeleton` | `skeleton::Skeleton` | Stateless. Loading placeholder |72| `Progress` | `progress::{ProgressBar, ProgressCircle}` | Stateless. |73| `Tooltip` | `tooltip::Tooltip` | Via `.tooltip()` on elements |74| `HoverCard` | `hover_card::{HoverCard, HoverCardState}` | Stateful. |75| `Image` | `image::Image` | Stateless. |76| `Clipboard` | `clipboard::Clipboard` | Stateless. Copy button |7778### Overlay & Popups79| Component | Import | Notes |80|-----------|--------|-------|81| `Dialog` | `dialog::Dialog` + `WindowExt` | Via `window.open_modal(...)` |82| `AlertDialog` | `WindowExt` | Via `window.open_alert_dialog(...)` |83| `Sheet` | `sheet::Sheet` + `WindowExt` | Side panel, via `window.open_sheet(...)` |84| `Notification` | `notification::Notification` + `WindowExt` | Via `window.push_notification(...)` |85| `Popover` | `popover::Popover` | Floating overlay |86| `Menu` | `menu::{PopupMenu, DropdownMenu}` | Context menus |87| `DropdownButton` | `button::DropdownButton` | Button with dropdown menu |8889### Navigation & Layout90| Component | Import | Notes |91|-----------|--------|-------|92| `Tabs` / `TabBar` | `tab::{Tab, TabBar}` | Tabbed interface |93| `Sidebar` | `sidebar::{Sidebar, SidebarMenu, ...}` | App navigation panel |94| `TitleBar` | `title_bar::TitleBar` | Window title bar |95| `Breadcrumb` | `breadcrumb::Breadcrumb` | Navigation breadcrumb |96| `Pagination` | `pagination::Pagination` | Page navigation |97| `Accordion` | `accordion::Accordion` | Collapsible sections |98| `Collapsible` | `collapsible::Collapsible` | Single collapsible |99| `GroupBox` | `group_box::GroupBox` | Labeled container |100| `Resizable` | `resizable::Resizable` | Draggable split panes |101| `Scrollable` | `scroll::Scrollbar` | Custom scrollbar |102| `FocusTrap` | `focus_trap::FocusTrap` | Keyboard trap for modals |103104### Data Display105| Component | Import | Notes |106|-----------|--------|-------|107| `DataTable` | `table::{DataTable, TableState, TableDelegate}` | Stateful. Full-featured table |108| `Table` | `table::{Table, ...}` | Simpler table |109| `VirtualList` | `{v_virtual_list, h_virtual_list}` | High-perf large lists |110| `List` | `list::{List, ListState, ListDelegate}` | Stateful. Searchable list |111| `Tree` | `tree::{Tree, TreeState, TreeDelegate}` | Stateful. Hierarchy |112| `DescriptionList` | `description_list::DescriptionList` | Key-value pairs |113| `Settings` | `settings::Settings` | Settings panel |114115### Charts116| Component | Import | Notes |117|-----------|--------|-------|118| `Chart` | `chart::Chart` | Bar, line, area, pie charts |119| `Plot` | `plot::Plot` | `#[derive(IntoPlot)]` for data |120121## Reference Files122123- [usage.md](references/usage.md) — setup patterns, component types, common examples124- [style-guide.md](references/style-guide.md) — code style for contributors