Field
UI SDK Field parts: label, description and validation errors wired to the control; FieldSet with a legend that names the group.
Example
We only use it for deploy alerts.
field-demo.tsxCopy code
Installation
Copy code
Usage
ImportCopy code
API reference
Field
| Prop | Type | Default |
|---|---|---|
labelPlacement`top` (default) above the control; `in` inside it, floating up on focus or a value; `on` on its border, over `--field-label-surface`. For text controls (Input, Textarea, Select, NumberInput, DatePicker, Combobox…). Unset in a Form, it takes the Form's only in the floating layout (`FieldLabel`, such a control, then only a description or error, no padding of its own). Wins over the Form's, `top` included. | "top" | "in" | "on" | – |
Also takes every prop of UI SDK Field.
FieldLabel
FieldDescription
FieldError
FieldLegend
FieldGroup
FieldSet
| Prop | Type | Default |
|---|---|---|
legendNames the group, and the radio or checkbox group inside it. | ReactNode | – |
description | ReactNode | – |
children | ReactNode | – |
Also takes every prop of UI SDK FieldSet except children.
Other exports
fieldSurfaceClassNameFieldLabelPlacementDefaultfloatingLabelControlsformControlAdapterspadsItselfuseFieldLabelPlacementuseFloatingPlaceholdertype FieldLabelPlacementtype FieldPropstype FieldSetPropstype FormControlAdapterAccessibility
- FieldLabel, FieldDescription and FieldError are linked to the control automatically.
- FieldError matches native validity states (valueMissing, typeMismatch…), shown after the field is touched.
Agent actions
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.