Introduction
gpui-form turns an application-owned Rust model into typed GPUI form state.
Derive GpuiForm, give each field one form intent, and use the generated
holder to validate and reconstruct the model.
This guide is for Rust application developers who use GPUI Kit. The workspace supports Rust 1.98. Use the published facade version shown in Getting started.
Mental model
A derived form separates the source model from the state owned by the view:
- The source struct defines the values the application accepts.
- Field intents decide which values have components, remain hidden, or stay under application control.
- Component shapes define construction, rendering, value binding, and holder storage.
- The generated holder collects edits, exposes validation, and reconstructs the source model.
For a source struct named UserProfile, the derive generates:
| Type | Purpose |
|---|---|
UserProfileFormField | Typed identity for component-backed fields |
UserProfileFormFields | GPUI entities owned by the form view |
UserProfileFormComponents | Constructors for those entities |
UserProfileFormValueHolder | Editable values, defaults, validation, and model conversion |
Choose a path
Start with Getting started to derive and wire a form. Use Field intents and generated types for hidden, skipped, or converted values. Continue to Component shapes to select widgets and Validation and conversion before submission.
MCP form tools describes structured submit and headless editing. Prototyping covers generating complete GPUI wiring from inventory metadata.