gpui-kit
它能做什么
说明如何用 Rust 中的 GPUI Kit 框架构建桌面应用,包括其组件库。它适用于希望获得一套现成界面部件的桌面应用开发者。
适用场景
- ✓当你要用 GPUI Kit 设置一个新的桌面应用的时候。
- ✓当你需要使用对话框、侧边栏或数据表格等组件的时候。
- ✓当你需要处理组件状态、主题或窗口浮层的时候。
技能链接
https://github.com/longbridge/gpui-kit/blob/main/skills/gpui-kit/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请用 GPUI Kit 设置一个桌面应用,包含侧边栏、数据表格和确认对话框。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能会先把智能体指向每个组件家族的约定指南,然后指向一份经过测试的应用方案,展示状态和浮层层如何协同工作。进行任何界面工作之前,必须先阅读设计指南。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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.
| Guide | Read before |
|---|---|
Design Guides, skill gpui-kit-design-guides |
Choosing components, layout, spacing, hierarchy, color, density, interaction states, overlays, motion, interface copy |
| Coding Guides | Crate 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).
| Section | Read when |
|---|---|
| Architecture at a glance | Always; crate layering, ownership boundary |
| Bootstrap and root ownership | main, init, Root, window creation, app-level state |
| Understand GPUI's phases and contexts | Anything touching App, Window, Context<T>, render vs update |
| Choose the right unit | Deciding RenderOnce vs Entity<T> vs custom Element |
| State ownership | Where a piece of state lives, who mutates it, Entity<State> handles |
| Stable identity | ElementId, lists, repeated elements, keyed state |
| Rendering and composition | render, builder chains, when/map, child composition |
| Behavior and presentation boundary | gpui-base vs gpui-component vs application code |
| Theme and styling | cx.theme(), tokens, Styled, sizes, variants |
| Events, actions, and focus | cx.emit, subscribe, actions!, keybindings, FocusHandle |
| Async work and side effects | cx.spawn, background_spawn, Task, I/O, timers |
| Layout, measurement, and scrolling | Flex layout, sizing, overflow, scroll handles, measuring |
| Lists, tables, and large data | VirtualList, List, DataTable, delegates, large collections |
| Public API design | Anything pub: builders, private fields, setter and reader naming |
| Platform and capability boundaries | macOS/Windows/Linux/wasm differences, feature gates |
| File and naming conventions | New files, modules, type and method names, Kind suffix, Context |
| Testing strategy | What to test, #[gpui_kit::test], TestAppContext |
常见问题
使用哪种编程语言?
Rust。
它提供完整的示例应用吗?
提供。一个经过测试的方案展示了包含状态、订阅和浮层层的完整视图。
设计规则从哪里获取?
来自 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 normativ
repo: longbridge/gpui-kit
热度
- GitHub 星标
- 19k
- 排名
- #10484
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …