Field
A form field layout system that pairs labels, inputs, descriptions, and error messages.
We will never share your email.
Installation
Composition
Field
A single control with label, helper text, and validation.
Field
├── FieldLabel
├── Input / Textarea / Switch / Select
├── FieldDescription
└── FieldErrorFieldGroup
Related fields in one group. Use FieldSeparator between sections when needed.
FieldGroup
├── Field
│ ├── FieldLabel
│ ├── Input / Textarea / Switch / Select
│ ├── FieldDescription
│ └── FieldError
├── FieldSeparator
└── Field
├── FieldLabel
└── Input / Textarea / Switch / SelectFieldSet
Semantic grouping with a legend and description, usually containing a FieldGroup.
FieldSet
├── FieldLegend
├── FieldDescription
└── FieldGroup
├── Field
│ ├── FieldLabel
│ ├── Input / Textarea / Switch / Select
│ ├── FieldDescription
│ └── FieldError
└── Field
├── FieldLabel
└── Input / Textarea / Switch / SelectAnatomy
The Field family is designed for composing accessible forms. A typical field is structured as follows:
<Field>
<FieldLabel htmlFor="input-id">Label</FieldLabel>
{/* Input, Select, Switch, etc. */}
<FieldDescription>Optional helper text.</FieldDescription>
<FieldError>Validation message.</FieldError>
</Field>Fieldis the core wrapper for a single field.FieldContentis a flex column that groups label and description. Not required if you have no description.- Wrap related fields with
FieldGroup, and useFieldSetwithFieldLegendfor semantic grouping.
Examples
Horizontal Layout
Receive emails about new products, features, and more.
Use orientation="horizontal" to place label/description on the left and the control on the right. Ideal for toggle rows.
With Error
Add data-invalid="true" to Field and aria-invalid="true" to the input to trigger error styles.
Multiple Errors
- Password must be at least 8 characters.
- Password must contain a number.
- Password must contain a special character.
Pass an errors array to FieldError to list multiple validation messages.
Disabled
This field cannot be edited.
Checkbox Group
Use FieldSet and FieldLegend to group related checkboxes or radio buttons with a shared label.
Full Form Example
Brief description for your profile.
Receive emails about new products and features.
Accessibility
FieldSetandFieldLegendkeep related controls grouped for keyboard and assistive tech users.Fieldoutputsrole="group"so nested controls inherit labeling fromFieldLabelandFieldLegendwhen combined.- Apply
FieldSeparatorsparingly to ensure screen readers encounter clear section boundaries.
API Reference
Field
| Prop | Type | Default |
|---|---|---|
orientation | "vertical" | "horizontal" | "responsive" | "vertical" |
data-invalid | "true" | — |
data-disabled | "true" | — |
FieldError
| Prop | Type | Default |
|---|---|---|
errors | Array<{ message: string }> | — |
FieldLegend
| Prop | Type | Default |
|---|---|---|
variant | "default" | "label" | "default" |
Subcomponents
| Component | Description |
|---|---|
FieldLabel | <label> element styled for the design system |
FieldDescription | Supporting helper text |
FieldError | Error message(s) displayed when invalid |
FieldGroup | Vertical stack of multiple Field components |
FieldSet | Fieldset wrapper for grouped controls |
FieldLegend | Legend/heading for a FieldSet |
FieldContent | Column of FieldTitle + FieldDescription for horizontal layouts |
FieldTitle | Bold title inside FieldContent |
FieldSeparator | Horizontal divider between field groups, with optional label |