BlueGit

ict rusty-teams

Files

rusty-teams / vendor / gpui-base / README.md

README.md

eef6c0a4 History
README.md 17.0 KiB Download Raw

gpui-base

Crates.io Documentation License

gpui-base is the reusable foundation of the GPUI Component Rust desktop application framework, built on GPUI. It is intended for applications that want to build and own their own design systems. It provides interaction behavior, focus management, accessibility semantics, animation, virtual lists, theme tokens, and other foundational capabilities without imposing a visual style.

> Use gpui-component if you want ready-to-use components with a complete visual design. Use gpui-base if your application should own its component source and visual styles while reusing stable, shared behavior.

Where It Fits in GPUI Component

GPUI Component is the framework and project brand. Its currently implemented architecture has two directly usable layers:

application
├── gpui-component     Complete, styled framework experience
└── custom UI          Application-owned design system
         └── gpui-base Interaction, state, and infrastructure (this crate)

Dependencies always point from higher layers toward the foundation: gpui-base does not depend on gpui-component. Existing applications can continue using gpui-component; a direct dependency on gpui-base is only necessary when building custom components or a design system.

Relationship to the shadcn Ecosystem

The GPUI Component ecosystem follows the same layering idea as shadcn:

GPUI ecosystemshadcn ecosystem
GPUIHTML + Tailwind CSS
gpui-baseBase UI
gpui-componentshadcn
crates/component in GPUI Componentshadcn's default UI

Design Principles

  • Behavior belongs to the foundation: click handling, keyboard activation, controlled state, focus, accessibility roles, and infrastructure.
  • Presentation belongs to the application: layout, size, color, spacing, radius, borders, shadows, variants, and animation are defined by the application or a higher-level component.
  • Applications own their components: foundation controls can be freely composed and modified without adopting a fixed visual language.
  • Semantic APIs come first: themes expose tokens such as primary, surface, and destructive instead of accumulating component-specific fields.
  • GPUI-native composition: controls implement GPUI interfaces such as Styled and ParentElement and work with GPUI's fluent builder API.

For example, Button::new("save") has no padding, background, radius, or size by default. Being unstyled is an explicit API contract, not a missing feature.

Installation

Depend on gpui-kit, which pins the GPUI crates gpui-base was built against and re-exports them as gpui_kit::gpui and gpui_kit::platform, with gpui-base itself always available at gpui_kit::base. Turn off the default features to skip the styled layers:

[dependencies]
gpui-kit = { version = "0.7", default-features = false }

If Cargo reports incompatible GPUI types, check whether your application pulls GPUI in from somewhere other than gpui-kit.

Optional Features

FeatureEnabled by defaultPurpose
inspectorNoEnables inspector support in both gpui and gpui_macros

Initialization

Call gpui_kit::base::init(cx) once before creating windows or using foundation controls. It installs the global theme and focus-trap infrastructure required by the base layer.

use gpui_kit::*;

fn main() {
    gpui_kit::application().run(|cx| {
        gpui_kit::base::init(cx);

        // Create windows and views after initialization.
    });
}

If the application already calls gpui_kit::init(cx), do not call gpui_kit::base::init(cx) again. The higher-level initializer includes base initialization.

Quick Start

Foundation controls can be styled and given children like ordinary GPUI elements:

use gpui_kit::prelude::*;
use gpui_kit::{Context, IntoElement, Render, Window, px, rgb};
use gpui_kit::base::Button;

struct SaveButton;

impl Render for SaveButton {
    fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
        Button::new("save")
            .px_3()
            .py_2()
            .rounded(px(6.))
            .bg(rgb(0x2563eb))
            .text_color(rgb(0xffffff))
            .accessibility_label("Save document")
            .on_click(|_, _, _| println!("save"))
            .child("Save")
    }
}

An ElementId must remain stable within a view so GPUI can preserve focus and element state. Button handles pointer, Enter, and Space activation through one path and provides disabled, selected, tab_index, and tab_stop for semantic state and focus traversal.

Controlled State

Checkbox, Radio, Switch, and Toggle are controlled components. Their callbacks report the next value; the application updates its own state and passes that value back on the next render:

use gpui_kit::prelude::*;
use gpui_kit::{Context, IntoElement, Render, Window};
use gpui_kit::base::{Checkbox, CheckboxIndicator};

struct Settings {
    telemetry: bool,
}

impl Render for Settings {
    fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
        let checked = self.telemetry;
        let settings = cx.entity().downgrade();

        Checkbox::new("telemetry")
            .checked(checked)
            .accessibility_label("Send anonymous usage data")
            .on_change(move |state, _, cx| {
                _ = settings.update(cx, |this, cx| {
                    this.telemetry = state == gpui_kit::base::CheckboxState::Checked;
                    cx.notify();
                });
            })
            .child(
                CheckboxIndicator::new()
                    .checked(checked)
                    .child(if checked { "✓" } else { "" }),
            )
            .child("Send anonymous usage data")
    }
}

The caller also defines how semantic states look. For example:

Button::new("menu-trigger")
    .selected(menu_open)
    .disabled(is_busy)
    .styles(|styles| {
        styles
            .selected(|style| style.bg(rgb(0xe2e8f0)))
            .disabled(|style| style.opacity(0.5))
    })
    .child("Menu")

Semantic state styles express states such as checked, pressed, selected, indeterminate, and disabled. Every control resolves its final style in one fixed order:

1. the style applied directly in the main builder chain, 2. value states such as checked, pressed, selected, or focused, 3. disabled, which is always resolved last.

Semantic states therefore layer over the builder chain, the same way GPUI layers hover, active, and focus_visible on top of an element's base style. A state only overrides the fields it sets, so unrelated builder-chain styles are preserved. To keep a specific builder-chain style as the closest layer even while a state is active, replay it inside that state:

Button::new("save")
    .bg(brand)
    .styles(|styles| styles.disabled(|style| style.opacity(0.5).bg(brand)))

Base controls cannot suppress hover or active styles while disabled, because GPUI does not expose those refinements. Guard them at the call site with when(!disabled, ..).

Capability Overview

Unstyled Controls

APIBehavior provided
ButtonClick and keyboard activation, focus, disabled and selected states, and the Button accessibility role
Checkbox / CheckboxIndicatorChecked, unchecked, and indeterminate states with corresponding accessibility semantics
Radio / RadioGroupRadio activation, focus, and a grouping container
Switch / SwitchTrack / SwitchThumbA controlled switch with independently styled track and thumb parts
Toggle / ToggleGroupA controlled pressed state and grouping container
LinkLink semantics and activation with an application-provided open_with navigation strategy
Table and semantic table partsTable, row-group, row, column-header, cell roles, and accessibility indices without layout or styling
Toast / ToastStack / ToastManagerAlert semantics, lifecycle, timers, limits, measured stack geometry, and interaction-aware motion

Text Editing

Text editing is split into purpose-specific controls instead of exposing the complete editor interface on every text field:

ControlStateUse
InputInputStateSingle-line values, masking, validation, and number stepping
TextareaTextareaStateOrdinary multi-line text, fixed rows, wrapping, and auto-grow
EditorEditorStateSource code, highlighting, gutter, folding, decorations, diagnostics, and LSP integration

All three share the internal InputBaseState editing engine. Applications should construct the purpose-specific state rather than configuring modes on the shared engine.

The base layer never opens a URL by itself. This allows the same Link to target internal routing, an embedded web view, or the system browser.

Focus and Interaction

  • FocusTrapElement turns an interactive element into a focus trap. Tab and Shift-Tab cycle within the container.
  • active_focus_trap returns the active focus trap for a window.
  • InteractiveElementExt adds interaction helpers to GPUI interactive elements.
  • ElementExt adds post-layout, prepaint observation to parent elements.
  • FocusableExt draws a focus ring using the application theme.

Scrolling and Large Data Sets

  • Scrollbar supports ScrollHandle, UniformListScrollHandle, ListState, and VirtualListScrollHandle, with vertical, horizontal, and dual-axis modes.
  • ScrollbarMode controls when a scrollbar is visible.
  • v_virtual_list and h_virtual_list render only the visible range while allowing every item to have a different size.
  • VirtualListScrollHandle reads or updates a virtual list's scroll position.
  • AutoScroll provides timer-based edge scrolling during drag interactions.

A virtual list requires the caller to provide item sizes. Vertical lists use each item's height, while horizontal lists use each item's width. Unlike GPUI's uniform_list, this is suitable for data whose rows or columns do not share one size.

Animation

gpui-base provides two animation APIs:

  • motion::transition is the preferred value-transition API. The caller chooses the animated property; it supports duration, delay, custom easing, smooth target reversal, and reduced-motion preferences.
  • animation::Transition is the legacy element-animation API for composing fade, slide, and size effects.

Foundation controls do not install animation automatically. Applications choose animation properties and timing according to their own visual language.

See the Motion guide and run its five focused interactive demonstrations with:

cargo run -p gpui-base-examples --bin motion

Themes and Styles

  • Theme stores base-layer global configuration, including semantic tokens and scrollbar defaults.
  • SemanticThemeTokens contains colors, radius, spacing, typography, and shadow scales.
  • StateStyle is a semantic-state style builder compatible with fluent helpers such as when and when_some.
  • StyledExt provides common helpers for horizontal and vertical flex layouts, margins and padding, font weights, focus styling, and debug outlines.
  • h_flex, v_flex, and box_shadow are common element and style constructors.

The global base theme can be customized after initialization:

use gpui_kit::{px, rgb};
use gpui_kit::base::Theme;

let theme = Theme::global_mut(cx);
theme.tokens.colors.primary = rgb(0x2563eb).into();
theme.tokens.radius.md = px(8.);

Tokens describe design semantics; they do not automatically style unstyled controls. Applications read and apply these tokens in their own component implementations.

General Data and Layout Utilities

APIPurpose
HistoryBrowser-style navigation trail with back and forward entries
UndoHistoryGrouped undo and redo transactions
SliderStateSingle or range values, linear or logarithmic scales, and slider events
IndexPathA section, row, and column index path
Placement / SidePlacement and layout direction descriptions
AxisExt / LengthExt / EdgesGPUI geometry extensions and serializable edges

Relationship to gpui-component

The crates target different abstraction levels and can be used in the same application:

gpui-basegpui-component
RoleBehavior and infrastructureComplete UI component library
Default presentationNoneIncluded
Visual style ownerApplicationComponent library, customizable through its Theme and APIs
Best suited forCustom design systems, registry components, and foundation reuseBuilding complete desktop applications quickly
Initializationgpui_kit::base::init(cx)gpui_kit::init(cx), which includes base initialization

Do not migrate from gpui-component by mechanically replacing imports. For example, gpui_kit::component::button::Button is a fully styled higher-level component, while gpui_kit::base::Button requires the caller to provide its children and all presentation styles.

Platform Support

Platform support follows GPUI and GPUI Component:

  • macOS on Apple Silicon and Intel
  • Linux on x86_64
  • Windows on x86_64
  • WebAssembly support depends on the APIs in use and the GPUI Web runtime

Development and Verification

Run these commands from the GPUI Component repository root:

# Check the foundation crate
cargo check -p gpui-base

# Run the foundation crate tests
cargo test -p gpui-base

# Check formatting
cargo fmt --check

# Run Clippy
cargo clippy -p gpui-base -- --deny warnings

The current Rust interface is defined by the source code and generated API documentation. See ../../docs/ARCHITECTURE.md for the source-derived module architecture and ../../docs/STYLING-AND-MOTION.md for the style and motion contracts.

Related Resources

License

Apache-2.0. See ../../LICENSE-APACHE.

Source
1# gpui-base
2
3[![Crates.io](https://img.shields.io/crates/v/gpui-base.svg)](https://crates.io/crates/gpui-base)
4[![Documentation](https://docs.rs/gpui-base/badge.svg)](https://docs.rs/gpui-base)
5[![License](https://img.shields.io/crates/l/gpui-base.svg)](../../LICENSE-APACHE)
6
7`gpui-base` is the reusable foundation of the [GPUI Component](https://github.com/longbridge/gpui-kit) Rust desktop application framework, built on GPUI. It is intended for applications that want to build and own their own design systems. It provides interaction behavior, focus management, accessibility semantics, animation, virtual lists, theme tokens, and other foundational capabilities without imposing a visual style.
8
9> Use [`gpui-component`](https://crates.io/crates/gpui-component) if you want ready-to-use components with a complete visual design. Use `gpui-base` if your application should own its component source and visual styles while reusing stable, shared behavior.
10
11## Where It Fits in GPUI Component
12
13GPUI Component is the framework and project brand. Its currently implemented
14architecture has two directly usable layers:
15
16```text
17application
18├── gpui-component Complete, styled framework experience
19└── custom UI Application-owned design system
20 └── gpui-base Interaction, state, and infrastructure (this crate)
21```
22
23Dependencies always point from higher layers toward the foundation: `gpui-base` does not depend on `gpui-component`. Existing applications can continue using `gpui-component`; a direct dependency on `gpui-base` is only necessary when building custom components or a design system.
24
25## Relationship to the shadcn Ecosystem
26
27The GPUI Component ecosystem follows the same layering idea as [shadcn](https://ui.shadcn.com):
28
29| GPUI ecosystem | shadcn ecosystem |
30| ------------------------------------ | ------------------------------ |
31| GPUI | HTML + Tailwind CSS |
32| `gpui-base` | [Base UI](https://base-ui.com) |
33| `gpui-component` | shadcn |
34| `crates/component` in GPUI Component | shadcn's default UI |
35
36## Design Principles
37
38- **Behavior belongs to the foundation:** click handling, keyboard activation, controlled state, focus, accessibility roles, and infrastructure.
39- **Presentation belongs to the application:** layout, size, color, spacing, radius, borders, shadows, variants, and animation are defined by the application or a higher-level component.
40- **Applications own their components:** foundation controls can be freely composed and modified without adopting a fixed visual language.
41- **Semantic APIs come first:** themes expose tokens such as `primary`, `surface`, and `destructive` instead of accumulating component-specific fields.
42- **GPUI-native composition:** controls implement GPUI interfaces such as `Styled` and `ParentElement` and work with GPUI's fluent builder API.
43
44For example, `Button::new("save")` has no padding, background, radius, or size by default. Being unstyled is an explicit API contract, not a missing feature.
45
46## Installation
47
48Depend on `gpui-kit`, which pins the GPUI crates `gpui-base` was built
49against and re-exports them as `gpui_kit::gpui` and `gpui_kit::platform`, with
50`gpui-base` itself always available at `gpui_kit::base`. Turn off the default
51features to skip the styled layers:
52
53```toml
54[dependencies]
55gpui-kit = { version = "0.7", default-features = false }
56```
57
58If Cargo reports incompatible GPUI types, check whether your application pulls
59GPUI in from somewhere other than `gpui-kit`.
60
61### Optional Features
62
63| Feature | Enabled by default | Purpose |
64| ----------- | ------------------ | ---------------------------------------------------------- |
65| `inspector` | No | Enables inspector support in both `gpui` and `gpui_macros` |
66
67## Initialization
68
69Call `gpui_kit::base::init(cx)` once before creating windows or using foundation controls. It installs the global theme and focus-trap infrastructure required by the base layer.
70
71```rust
72use gpui_kit::*;
73
74fn main() {
75 gpui_kit::application().run(|cx| {
76 gpui_kit::base::init(cx);
77
78 // Create windows and views after initialization.
79 });
80}
81```
82
83If the application already calls `gpui_kit::init(cx)`, do not call `gpui_kit::base::init(cx)` again. The higher-level initializer includes base initialization.
84
85## Quick Start
86
87Foundation controls can be styled and given children like ordinary GPUI elements:
88
89```rust
90use gpui_kit::prelude::*;
91use gpui_kit::{Context, IntoElement, Render, Window, px, rgb};
92use gpui_kit::base::Button;
93
94struct SaveButton;
95
96impl Render for SaveButton {
97 fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
98 Button::new("save")
99 .px_3()
100 .py_2()
101 .rounded(px(6.))
102 .bg(rgb(0x2563eb))
103 .text_color(rgb(0xffffff))
104 .accessibility_label("Save document")
105 .on_click(|_, _, _| println!("save"))
106 .child("Save")
107 }
108}
109```
110
111An `ElementId` must remain stable within a view so GPUI can preserve focus and element state. `Button` handles pointer, Enter, and Space activation through one path and provides `disabled`, `selected`, `tab_index`, and `tab_stop` for semantic state and focus traversal.
112
113### Controlled State
114
115`Checkbox`, `Radio`, `Switch`, and `Toggle` are controlled components. Their callbacks report the next value; the application updates its own state and passes that value back on the next render:
116
117```rust
118use gpui_kit::prelude::*;
119use gpui_kit::{Context, IntoElement, Render, Window};
120use gpui_kit::base::{Checkbox, CheckboxIndicator};
121
122struct Settings {
123 telemetry: bool,
124}
125
126impl Render for Settings {
127 fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
128 let checked = self.telemetry;
129 let settings = cx.entity().downgrade();
130
131 Checkbox::new("telemetry")
132 .checked(checked)
133 .accessibility_label("Send anonymous usage data")
134 .on_change(move |state, _, cx| {
135 _ = settings.update(cx, |this, cx| {
136 this.telemetry = state == gpui_kit::base::CheckboxState::Checked;
137 cx.notify();
138 });
139 })
140 .child(
141 CheckboxIndicator::new()
142 .checked(checked)
143 .child(if checked { "✓" } else { "" }),
144 )
145 .child("Send anonymous usage data")
146 }
147}
148```
149
150The caller also defines how semantic states look. For example:
151
152```rust
153Button::new("menu-trigger")
154 .selected(menu_open)
155 .disabled(is_busy)
156 .styles(|styles| {
157 styles
158 .selected(|style| style.bg(rgb(0xe2e8f0)))
159 .disabled(|style| style.opacity(0.5))
160 })
161 .child("Menu")
162```
163
164Semantic state styles express states such as checked, pressed, selected, indeterminate, and disabled. Every control resolves its final style in one fixed order:
165
1661. the style applied directly in the main builder chain,
1672. value states such as `checked`, `pressed`, `selected`, or `focused`,
1683. `disabled`, which is always resolved last.
169
170Semantic states therefore layer over the builder chain, the same way GPUI layers `hover`, `active`, and `focus_visible` on top of an element's base style. A state only overrides the fields it sets, so unrelated builder-chain styles are preserved. To keep a specific builder-chain style as the closest layer even while a state is active, replay it inside that state:
171
172```rust
173Button::new("save")
174 .bg(brand)
175 .styles(|styles| styles.disabled(|style| style.opacity(0.5).bg(brand)))
176```
177
178Base controls cannot suppress `hover` or `active` styles while disabled, because GPUI does not expose those refinements. Guard them at the call site with `when(!disabled, ..)`.
179
180## Capability Overview
181
182### Unstyled Controls
183
184| API | Behavior provided |
185| ---------------------------------------- | ----------------------------------------------------------------------------------------------------- |
186| `Button` | Click and keyboard activation, focus, disabled and selected states, and the Button accessibility role |
187| `Checkbox` / `CheckboxIndicator` | Checked, unchecked, and indeterminate states with corresponding accessibility semantics |
188| `Radio` / `RadioGroup` | Radio activation, focus, and a grouping container |
189| `Switch` / `SwitchTrack` / `SwitchThumb` | A controlled switch with independently styled track and thumb parts |
190| `Toggle` / `ToggleGroup` | A controlled pressed state and grouping container |
191| `Link` | Link semantics and activation with an application-provided `open_with` navigation strategy |
192| `Table` and semantic table parts | Table, row-group, row, column-header, cell roles, and accessibility indices without layout or styling |
193| `Toast` / `ToastStack` / `ToastManager` | Alert semantics, lifecycle, timers, limits, measured stack geometry, and interaction-aware motion |
194
195### Text Editing
196
197Text editing is split into purpose-specific controls instead of exposing the
198complete editor interface on every text field:
199
200| Control | State | Use |
201| ------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------- |
202| [`Input`](../../website/base/primitives/input.md) | `InputState` | Single-line values, masking, validation, and number stepping |
203| [`Textarea`](../../website/base/primitives/textarea.md) | `TextareaState` | Ordinary multi-line text, fixed rows, wrapping, and auto-grow |
204| [`Editor`](../../website/base/primitives/editor.md) | `EditorState` | Source code, highlighting, gutter, folding, decorations, diagnostics, and LSP integration |
205
206All three share the internal `InputBaseState` editing engine. Applications
207should construct the purpose-specific state rather than configuring modes on
208the shared engine.
209
210The base layer never opens a URL by itself. This allows the same `Link` to target internal routing, an embedded web view, or the system browser.
211
212### Focus and Interaction
213
214- `FocusTrapElement` turns an interactive element into a focus trap. Tab and Shift-Tab cycle within the container.
215- `active_focus_trap` returns the active focus trap for a window.
216- `InteractiveElementExt` adds interaction helpers to GPUI interactive elements.
217- `ElementExt` adds post-layout, prepaint observation to parent elements.
218- `FocusableExt` draws a focus ring using the application theme.
219
220### Scrolling and Large Data Sets
221
222- `Scrollbar` supports `ScrollHandle`, `UniformListScrollHandle`, `ListState`, and `VirtualListScrollHandle`, with vertical, horizontal, and dual-axis modes.
223- `ScrollbarMode` controls when a scrollbar is visible.
224- `v_virtual_list` and `h_virtual_list` render only the visible range while allowing every item to have a different size.
225- `VirtualListScrollHandle` reads or updates a virtual list's scroll position.
226- `AutoScroll` provides timer-based edge scrolling during drag interactions.
227
228A virtual list requires the caller to provide item sizes. Vertical lists use each item's height, while horizontal lists use each item's width. Unlike GPUI's `uniform_list`, this is suitable for data whose rows or columns do not share one size.
229
230### Animation
231
232`gpui-base` provides two animation APIs:
233
234- `motion::transition` is the preferred value-transition API. The caller chooses the animated property; it supports duration, delay, custom easing, smooth target reversal, and reduced-motion preferences.
235- `animation::Transition` is the legacy element-animation API for composing fade, slide, and size effects.
236
237Foundation controls do not install animation automatically. Applications choose animation properties and timing according to their own visual language.
238
239See the [Motion guide](../../website/base/motion.md) and run its five focused interactive demonstrations with:
240
241```bash
242cargo run -p gpui-base-examples --bin motion
243```
244
245### Themes and Styles
246
247- `Theme` stores base-layer global configuration, including semantic tokens and scrollbar defaults.
248- `SemanticThemeTokens` contains `colors`, `radius`, `spacing`, `typography`, and `shadow` scales.
249- `StateStyle` is a semantic-state style builder compatible with fluent helpers such as `when` and `when_some`.
250- `StyledExt` provides common helpers for horizontal and vertical flex layouts, margins and padding, font weights, focus styling, and debug outlines.
251- `h_flex`, `v_flex`, and `box_shadow` are common element and style constructors.
252
253The global base theme can be customized after initialization:
254
255```rust
256use gpui_kit::{px, rgb};
257use gpui_kit::base::Theme;
258
259let theme = Theme::global_mut(cx);
260theme.tokens.colors.primary = rgb(0x2563eb).into();
261theme.tokens.radius.md = px(8.);
262```
263
264Tokens describe design semantics; they do not automatically style unstyled controls. Applications read and apply these tokens in their own component implementations.
265
266### General Data and Layout Utilities
267
268| API | Purpose |
269| --------------------------------- | ----------------------------------------------------------------------- |
270| `History` | Browser-style navigation trail with back and forward entries |
271| `UndoHistory` | Grouped undo and redo transactions |
272| `SliderState` | Single or range values, linear or logarithmic scales, and slider events |
273| `IndexPath` | A section, row, and column index path |
274| `Placement` / `Side` | Placement and layout direction descriptions |
275| `AxisExt` / `LengthExt` / `Edges` | GPUI geometry extensions and serializable edges |
276
277## Relationship to gpui-component
278
279The crates target different abstraction levels and can be used in the same application:
280
281| | `gpui-base` | `gpui-component` |
282| -------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------- |
283| Role | Behavior and infrastructure | Complete UI component library |
284| Default presentation | None | Included |
285| Visual style owner | Application | Component library, customizable through its Theme and APIs |
286| Best suited for | Custom design systems, registry components, and foundation reuse | Building complete desktop applications quickly |
287| Initialization | `gpui_kit::base::init(cx)` | `gpui_kit::init(cx)`, which includes base initialization |
288
289Do not migrate from `gpui-component` by mechanically replacing imports. For example, `gpui_kit::component::button::Button` is a fully styled higher-level component, while `gpui_kit::base::Button` requires the caller to provide its children and all presentation styles.
290
291## Platform Support
292
293Platform support follows GPUI and GPUI Component:
294
295- macOS on Apple Silicon and Intel
296- Linux on x86_64
297- Windows on x86_64
298- WebAssembly support depends on the APIs in use and the GPUI Web runtime
299
300## Development and Verification
301
302Run these commands from the GPUI Component repository root:
303
304```bash
305# Check the foundation crate
306cargo check -p gpui-base
307
308# Run the foundation crate tests
309cargo test -p gpui-base
310
311# Check formatting
312cargo fmt --check
313
314# Run Clippy
315cargo clippy -p gpui-base -- --deny warnings
316```
317
318The current Rust interface is defined by the source code and generated API
319documentation. See [`../../docs/ARCHITECTURE.md`](../../docs/ARCHITECTURE.md)
320for the source-derived module architecture and
321[`../../docs/STYLING-AND-MOTION.md`](../../docs/STYLING-AND-MOTION.md) for the
322style and motion contracts.
323
324## Related Resources
325
326- [GPUI Kit repository](https://github.com/longbridge/gpui-kit)
327- [GPUI Kit documentation](https://gpui-kit.com)
328- [`gpui-component` crate](https://crates.io/crates/gpui-component)
329- [`gpui-base` API documentation](https://docs.rs/gpui-base)
330- GPUI
331- [Contributing guide](../../CONTRIBUTING.md)
332
333## License
334
335Apache-2.0. See [`../../LICENSE-APACHE`](../../LICENSE-APACHE).