Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

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:

  1. The source struct defines the values the application accepts.
  2. Field intents decide which values have components, remain hidden, or stay under application control.
  3. Component shapes define construction, rendering, value binding, and holder storage.
  4. The generated holder collects edits, exposes validation, and reconstructs the source model.

For a source struct named UserProfile, the derive generates:

TypePurpose
UserProfileFormFieldTyped identity for component-backed fields
UserProfileFormFieldsGPUI entities owned by the form view
UserProfileFormComponentsConstructors for those entities
UserProfileFormValueHolderEditable 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.