本文へ移動
cccskills
無料GitHub で公開

gpui-kit

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 including UI integration testing. 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.

インストール方法を見る

含まれるファイル(27)

  • SKILL.md22.0 KB
  • references/coding-guides.md43.1 KB
  • references/conventions.md5.2 KB
  • references/gpui/action.md5.0 KB
  • references/gpui/async.md6.2 KB
  • references/gpui/context.md6.2 KB
  • references/gpui/element-advanced.md20.0 KB
  • references/gpui/element-api.md11.0 KB
  • references/gpui/element-best-practices.md13.2 KB
  • references/gpui/element-examples.md17.7 KB
  • references/gpui/element-id.md2.4 KB
  • references/gpui/element-patterns.md14.7 KB
  • references/gpui/element.md3.9 KB
  • references/gpui/entity-advanced.md12.6 KB
  • references/gpui/entity-api.md8.5 KB
  • references/gpui/entity-best-practices.md14.7 KB
  • references/gpui/entity-patterns.md12.9 KB
  • references/gpui/entity.md7.2 KB
  • references/gpui/event.md5.6 KB
  • references/gpui/focus-handle.md7.0 KB
  • references/gpui/global.md3.8 KB
  • references/gpui/layout-style.md6.2 KB
  • references/gpui/test-examples.md3.8 KB
  • references/gpui/test-reference.md18.4 KB
  • references/gpui/test.md17.8 KB
  • references/recipes.md5.2 KB
  • references/usage.md11.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

GPUI Kit

Applications depend on one crate, gpui-kit. GPUI is use gpui_kit::*;, and each layer is reachable by name: gpui_kit::component (styled components), gpui_kit::base (unstyled behavior), gpui_kit::assets (default icons), gpui_kit::platform.

Start with component-family conventions to choose the constructor, state owner, event, and layout contract for the task. Learn the family once, then verify the specific component supports the capability.

For a complete compiled view with retained state, subscriptions, and overlay layers, read the tested application recipe.

Read the Guides First

Two guides hold the rules this skill assumes. They are requirements, not inspiration. Read the guide file itself; do not answer from this page, from a similar file in the codebase, or from training data.

GuideRead before
Design Guides, skill gpui-kit-design-guidesChoosing components, layout, spacing, hierarchy, color, density, interaction states, overlays, motion, interface copy
Coding GuidesCrate layering, RenderOnce vs Entity<T>, state ownership, ElementId, events, focus, async, public API, naming, testing

Read the Design Guides first when the change has a visible surface: code structure preserves product intent, it does not replace it. If the design skill is not installed, fetch https://gpui-kit.com/docs/design-guides.md. The coding guide is a verbatim copy of https://gpui-kit.com/docs/coding-guides.md, so its links to ./design-guides.md and ./getting-started.md mean the design skill and https://gpui-kit.com/docs/getting-started.md.

Coding Guides section map

Read the whole guide for a new crate, module, or feature. For a narrow change, read "Architecture at a glance" and "Rules for coding agents" first, then the section for the change (grep -n '^## ' references/coding-guides.md).

SectionRead when
Architecture at a glanceAlways; crate layering, ownership boundary
Bootstrap and root ownershipmain, init, Root, window creation, app-level state
Understand GPUI's phases and contextsAnything touching App, Window, Context<T>, render vs update
Choose the right unitDeciding RenderOnce vs Entity<T> vs custom Element
State ownershipWhere a piece of state lives, who mutates it, Entity<State> handles
Stable identityElementId, lists, repeated elements, keyed state
Rendering and compositionrender, builder chains, when/map, child composition
Behavior and presentation boundarygpui-base vs gpui-component vs application code
Theme and stylingcx.theme(), tokens, Styled, sizes, variants
Events, actions, and focuscx.emit, subscribe, actions!, keybindings, FocusHandle
Async work and side effectscx.spawn, background_spawn, Task, I/O, timers
Layout, measurement, and scrollingFlex layout, sizing, overflow, scroll handles, measuring
Lists, tables, and large dataVirtualList, List, DataTable, delegates, large collections
Public API designAnything pub: builders, private fields, setter and reader naming
Platform and capability boundariesmacOS/Windows/Linux/wasm differences, feature gates
File and naming conventionsNew files, modules, type and method names, Kind suffix, Context
Testing strategyWhat to test, #[gpui_kit::test], TestAppContext
Performance rulesRender cost, allocation, re-render triggers
Common failure modesBefore finishing; invented APIs, state in render, index ids
Rules for coding agentsAlways when an agent writes code
Implementation checklistBefore finishing; run every item against the work

Non-negotiables

A floor, not a substitute for the guides.

  • 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 that does not exist is the most common failure.
  • One dependency. Applications depend on gpui-kit alone. GPUI is use gpui_kit::*;; the layers are gpui_kit::component, gpui_kit::base, gpui_kit::assets, gpui_kit::platform.
  • Framework owns behavior, application owns presentation. Do not put colors, sizing, or layout in gpui-base; do not put interaction behavior in application styling code.
  • Stable identity. Repeated elements need domain-derived ElementIds, not list indexes.
  • No pub fields across the seam. Public data types use builders and reader methods.
  • Spell Context out. cx is GPUI's; name anything else after what it holds.

Documentation

  • Find a task/component page: use https://gpui-kit.com/llms.txt, then load its Markdown page.
  • Full reference: https://gpui-kit.com/llms-full.txt is available when broad reference is actually needed
  • Per-component API: fetch https://gpui-kit.com/component/{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 and examples: references/usage.md.

use gpui_kit::*;

gpui_kit::application()
    .with_assets(gpui_kit::assets::Assets)
    .run(|cx| {
        gpui_kit::init(cx);                       // first, before anything else
        gpui_kit::open_window(options, cx, |window, cx| {
            cx.new(|cx| AppView::new(window, cx))
        })
        .expect("failed to open window");
    });
  • Stateless (RenderOnce): build in render: Button::new("save").primary().label("Save").on_click(|_, _, _| {})
  • Stateful: hold Entity<State> in the view, pass a reference in render: let input = cx.new(|cx| InputState::new(window, cx)); then Input::new(&self.input)
  • Sizes: .xsmall() .small() .medium() (default) .large()
  • Theme: cx.theme().primary · .background · .foreground · .border · .muted
  • Overlays: window.open_dialog(...), open_sheet(...), push_notification(...) via gpui_kit::component::WindowExt

Component Catalog

Import paths are relative to gpui_kit::component::, so input::{Input, InputState} means use gpui_kit::component::input::{Input, InputState};. For the full API fetch the component's .md doc.

Input & Form

ComponentImportNotes
Inputinput::{Input, InputState}Stateful. Text, password, mask, validation
Textareainput::{Textarea, TextareaState}Stateful. Multi-line text
Editorinput::{Editor, EditorState}Stateful. Code editor, tree-sitter feature
NumberInputinput::{NumberInput, NumberInputEvent}Stateful. Numeric with step
OtpInputinput::OtpInputStateful. One-time password
SpeechButtonspeech::{SpeechButton, SpeechState}Stateful. Dictation, speech feature
Selectselect::{Select, SelectState}Stateful. Dropdown picker
Comboboxcombobox::{Combobox, ComboboxState}Stateful. Searchable select
Checkboxcheckbox::CheckboxStateless. on_click receives &bool
Switchswitch::SwitchStateless. Toggle
Radioradio::{Radio, RadioGroup}Stateless.
Sliderslider::{Slider, SliderState}Stateful.
Togglebutton::ToggleStateless.
Ratingrating::RatingStateless.
Stepperstepper::StepperStateless. Multi-step progress
ColorPickercolor_picker::{ColorPicker, ColorPickerState}Stateful.
DatePickerdate_picker::{DatePicker, DatePickerState}Stateful.
TimeFieldtime_field::{TimeField, TimeFieldState}Stateful. Time of day, 24/12-hour
Calendarcalendar::{Calendar, CalendarState}Stateful. Inline month view
Formform::{v_form, h_form, field}Layout container for form fields

Display & Feedback

ComponentImportNotes
Buttonbutton::{Button, ButtonGroup}Stateless. Primary UI action
Icon{Icon, IconName}Stateless. Lucide icons
Badgebadge::BadgeStateless.
Tagtag::TagStateless. Closable tags
Avataravatar::AvatarStateless.
Labellabel::LabelStateless. Form label
Kbdkbd::KbdStateless. Keyboard key display
Alertalert::AlertStateless. Info/success/warning/error
Spinnerspinner::SpinnerStateless. Loading indicator
Skeletonskeleton::SkeletonStateless. Loading placeholder
Shimmershimmer::{ShimmerText, ShimmerStyle}Stateless. Streaming-text shimmer
Markermarker::{Marker, MarkerVariant}Stateless. Inline status marker
Progressprogress::{Progress, ProgressCircle}Stateless.
Tooltiptooltip::TooltipVia .tooltip() on elements
HoverCardhover_card::{HoverCard, HoverCardState}Stateful.
Clipboardclipboard::ClipboardStateless. Copy button
TextViewtext::TextViewTextView::markdown(id, text), HTML too
Imagegpui_kit::{img, ImageSource, ObjectFit}GPUI's img() element

Overlay & Popups

ComponentImportNotes
Dialogdialog::Dialog + WindowExtVia window.open_dialog(...)
AlertDialogWindowExtVia window.open_alert_dialog(...)
Sheetsheet::Sheet + WindowExtSide panel, via window.open_sheet(...)
Notificationnotification::Notification + WindowExtVia window.push_notification(...)
Popoverpopover::PopoverFloating overlay
Menumenu::{PopupMenu, DropdownMenu}Context menus
DropdownButtonbutton::DropdownButtonButton with dropdown menu
Commandcommand::{Command, CommandState, CommandGroup}Stateful. Command palette
Focus trapFocusTrapElement.focus_trap(id, &handle) on a container; Dialog and Sheet have it built in

Navigation & Layout

ComponentImportNotes
Tabs / TabBartab::{Tab, TabBar}Tabbed interface
Sidebarsidebar::{Sidebar, SidebarMenu, ...}App navigation panel
TitleBarTitleBarWindow title bar
StatusBarstatus_bar::StatusBarWindow status bar
Breadcrumbbreadcrumb::BreadcrumbNavigation breadcrumb
Paginationpagination::PaginationPage navigation
Accordionaccordion::AccordionCollapsible sections
Collapsiblecollapsible::CollapsibleSingle collapsible
GroupBoxgroup_box::GroupBoxLabeled container
Resizableresizable::{h_resizable, v_resizable, resizable_panel, ResizableState}Draggable split panes
ResizeHandleresizable::{resize_handle, HandleEdge}Standalone resize edge
Scrollbarscroll::ScrollbarCustom scrollbar

Data Display

ComponentImportNotes
DataTabletable::{DataTable, TableState, TableDelegate}Stateful. Full-featured table
Diffdiff::{Diff, DiffState, DiffFile}Retained state, RenderOnce element. Readonly unified/Git diff display of one or more files, merge conflicts and source files; application supplies the patch
Tabletable::{Table, ...}Simpler table
VirtualList{v_virtual_list, h_virtual_list}High-perf large lists
Listlist::{List, ListState, ListDelegate}Stateful. Searchable list
Treetree::{Tree, TreeState, TreeItem, TreeEntry}Stateful. Hierarchy
DescriptionListdescription_list::DescriptionListKey-value pairs
Settingssetting::SettingsSettings panel

Chat & Messaging

ComponentImportNotes
Messagemessage::{Message, MessageContent, MessageAlignment}Stateless. Chat message row
Bubblebubble::{Bubble, BubbleContent, BubbleVariant}Stateless. Message bubble
Attachmentattachment::{Attachment, AttachmentContent, ...}Stateless. File/media attachment card
MessageScrollermessage_scroller::{MessageScroller, MessageScrollerState}Stateful. Auto-scrolling message list

Charts

ComponentImportNotes
Chartchart::{AreaChart, BarChart, LineChart, PieChart, RadarChart}Bar, line, area, pie charts
Plotplot::Plot#[derive(IntoPlot)] for data

Testing

UI integration testing means rendering real components in headless windows, simulating input, and checking state, focus, layout and owner callbacks. Use #[gpui_kit::test] to run tests and gpui_kit::test to operate and inspect the UI. When asked to add component interaction coverage, describe it as UI integration testing.

For unit tests, GPUI context tests or UI integration tests, read Testing. It includes dependency setup, a complete runnable UI flow, scoped native interactions, frame/async handling and the limits of accessibility and geometry assertions. Use the production view and verify the action's outcome through normal Rust assertions.

GPUI References

Load the file for the mechanism the task touches. Each file starts with a contents line.

TopicFileLoad when
Actions & keybindingsaction.mdactions!, bind_keys, on_action, key_context
Async & background tasksasync.mdcx.spawn, background_spawn, Task, async I/O
Context managementcontext.mdApp, Window, Context<T>, AsyncApp
Custom elements (low-level)element.mdElement trait, request_layout, prepaint, paint
Entity stateentity.mdEntity<T>, WeakEntity, state management
Events & subscriptionsevent.mdcx.emit, cx.subscribe, cx.observe
Focus & keyboard navfocus-handle.mdFocusHandle, track_focus, Tab navigation
Global stateglobal.mdGlobal trait, cx.set_global, app-wide config
Layout & stylinglayout-style.mddiv(), h_flex(), v_flex(), flexbox, overflow, positioning
ElementIdelement-id.mdElementId, .id(), uniqueness rules, stateful elements
Testingtest.md#[gpui_kit::test], TestAppContext, VisualTestContext

Deep dives, for when the topic file is not enough:

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

The normative Design Guides for GPUI Kit desktop applications. Read in full before designing or changing any screen, layout, spacing, visual hierarchy, color, density, component choice, interaction state, overlay, motion, data-heavy view, or interface copy in a GPUI Kit (gpui-kit / gpui-component) application, and before reviewing UI work for design quality. Also use when asked what the design rules are, or whether a UI decision follows them.

日本語の概要は準備中です。原文の説明を表示しています。

longbridge/gpui-kit1.7万2026年10月10日 更新

longbridge のスキルをすべて見る

このスキルの問題を報告する