Loading...
Loading...
How to build desktop applications with GPUI Kit, the Rust framework published as the gpui-kit crate (GPUI plus gpui_kit::component, gpui_kit::base, gpui_kit::assets). Use when setting up a gpui-kit app, choosing or using a component (Button, Input, Select, Dialog, Sheet, Tabs, Sidebar, List, DataTable, Tree, Chart, etc.), handling component state, theming, or window overlays, and for GPUI mechanics: actions and keybindings, async tasks, contexts, custom elements, entities, events, focus, global state, layout and styling, ElementId, and tests. Holds the normative Coding Guides: read them before any architecture, state-ownership, public API, naming, or testing decision. Pairs with the gpui-kit-design-guides skill for the Design Guides.
npx skill4agent add longbridge/gpui-kit gpui-kitgpui-kituse gpui_kit::*;gpui_kit::componentgpui_kit::basegpui_kit::assetsgpui_kit::platform| Guide | Read before |
|---|---|
Design Guides, skill | Choosing components, layout, spacing, hierarchy, color, density, interaction states, overlays, motion, interface copy |
| Coding Guides | Crate layering, |
https://gpui-kit.com/docs/design-guides.mdhttps://gpui-kit.com/docs/coding-guides.md./design-guides.md./getting-started.mdhttps://gpui-kit.com/docs/getting-started.mdgrep -n '^## ' references/coding-guides.md| Section | Read when |
|---|---|
| Architecture at a glance | Always; crate layering, ownership boundary |
| Bootstrap and root ownership | |
| Understand GPUI's phases and contexts | Anything touching |
| Choose the right unit | Deciding |
| State ownership | Where a piece of state lives, who mutates it, |
| Stable identity | |
| Rendering and composition | |
| Behavior and presentation boundary | |
| Theme and styling | |
| Events, actions, and focus | |
| Async work and side effects | |
| Layout, measurement, and scrolling | Flex layout, sizing, |
| Lists, tables, and large data | |
| Public API design | Anything |
| Platform and capability boundaries | macOS/Windows/Linux/wasm differences, feature gates |
| File and naming conventions | New files, modules, type and method names, |
| Testing strategy | What to test, |
| Performance rules | Render cost, allocation, re-render triggers |
| Common failure modes | Before finishing; invented APIs, state in render, index ids |
| Rules for coding agents | Always when an agent writes code |
| Implementation checklist | Before finishing; run every item against the work |
gpui-kituse gpui_kit::*;gpui_kit::componentgpui_kit::basegpui_kit::assetsgpui_kit::platformgpui-baseElementIdpubContextcxhttps://gpui-kit.com/llms-full.txthttps://gpui-kit.com/docs/components/{name}.mdbutton.mdinput.mdselect.mddialog.mddata-table.md.mduse gpui_kit::*;
use gpui_kit::component::Root;
gpui_kit::application()
.with_assets(gpui_kit::assets::Assets)
.run(|cx| {
gpui_kit::init(cx); // first, before anything else
// ... open_window(..., |window, cx| cx.new(|cx| Root::new(view, window, cx)))
});RenderOncerenderButton::new("save").primary().label("Save").on_click(|_, _, _| {})Entity<State>renderlet input = cx.new(|cx| InputState::new(window, cx));Input::new(&self.input).xsmall().small().medium().large()cx.theme().primary.background.foreground.border.mutedwindow.open_dialog(...)open_sheet(...)push_notification(...)gpui_kit::component::WindowExtgpui_kit::component::input::{Input, InputState}use gpui_kit::component::input::{Input, InputState};.md| Component | Import | Notes |
|---|---|---|
| | Stateful. Text, password, mask, validation |
| | Stateful. Multi-line text |
| | Stateful. Code editor, |
| | Stateful. Numeric with step |
| | Stateful. One-time password |
| | Stateful. Dropdown picker |
| | Stateful. Searchable select |
| | Stateless. |
| | Stateless. Toggle |
| | Stateless. |
| | Stateful. |
| | Stateless. |
| | Stateless. |
| | Stateless. Multi-step progress |
| | Stateful. |
| | Stateful. |
| | Stateful. Inline month view |
| | Layout container for form fields |
| Component | Import | Notes |
|---|---|---|
| | 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 |
| | Stateless. Streaming-text shimmer |
| | Stateless. Inline status marker |
| | Stateless. |
| | Via |
| | Stateful. |
| | Stateless. Copy button |
| | |
| Image | | GPUI's |
| Component | Import | Notes |
|---|---|---|
| | Via |
| | Via |
| | Side panel, via |
| | Via |
| | Floating overlay |
| | Context menus |
| | Button with dropdown menu |
| | Stateful. Command palette |
| Focus trap | | |
| Component | Import | Notes |
|---|---|---|
| | Tabbed interface |
| | App navigation panel |
| | Window title bar |
| | Window status bar |
| | Navigation breadcrumb |
| | Page navigation |
| | Collapsible sections |
| | Single collapsible |
| | Labeled container |
| | Draggable split panes |
| | Custom scrollbar |
| Component | Import | Notes |
|---|---|---|
| | Stateful. Full-featured table |
| | Simpler table |
| | High-perf large lists |
| | Stateful. Searchable list |
| | Stateful. Hierarchy |
| | Key-value pairs |
| | Settings panel |
| Component | Import | Notes |
|---|---|---|
| | Stateless. Chat message row |
| | Stateless. Message bubble |
| | Stateless. File/media attachment card |
| | Stateful. Auto-scrolling message list |
| Component | Import | Notes |
|---|---|---|
| | Bar, line, area, pie charts |
| | |
| Topic | File | Load when |
|---|---|---|
| Actions & keybindings | action.md | |
| Async & background tasks | async.md | |
| Context management | context.md | |
| Custom elements (low-level) | element.md | |
| Entity state | entity.md | |
| Events & subscriptions | event.md | |
| Focus & keyboard nav | focus-handle.md | |
| Global state | global.md | |
| Layout & styling | layout-style.md | |
| ElementId | element-id.md | |
| Testing | test.md | |