Usage
Use Field for a single control, including inputs, textareas, selects, date
pickers, checkboxes, and switches. Connect the label with matching htmlFor and
id values. Use useId() when a component can appear more than once.
Shown to your team members.
Keep the default gap-2 spacing between a field's label, control, and helper
text. Keep the default label color and line height too; avoid local overrides
for minor visual differences.
Field handles layout and state styling. It does not validate values, create
IDs, or connect descriptions automatically. Set aria-describedby on the
control to reference helper text and any visible error message.
Textarea
Only your team can see these notes.
Select
FieldLabel labels the trigger. SelectLabel labels a group of options inside
the popup. See Select for grouped options and sizes.
Horizontal
Use horizontal orientation for a checkbox or switch beside its label. Keep
Label for custom option cards and upload targets whose label is the clickable
surface.
Groups
Use FieldSet and FieldLegend to name a group of related controls. Give radio
groups an accessible name as well. Use horizontal fields for individual options.
Invalid
Set data-invalid on Field and aria-invalid on the control. Link errors
with aria-describedby. For Input and Textarea, error also controls their
border styling; an error object renders and links its own message.
Enter a valid email address.
Disabled
Set data-disabled on Field and disabled on the control. FieldSet
supports native disabled to disable all controls in the group.
React Hook Form
Keep using FormField, FormItem, FormLabel, FormControl,
FormDescription, and FormMessage from Form. They
compose the Field primitives while preserving generated IDs, validation state,
and description/error associations. Do not wrap FormItem in another Field.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | 'vertical' | 'horizontal' | 'vertical' | Layout direction for Field. |
data-invalid | boolean | - | Marks Field invalid and styles its label. Set aria-invalid on the control too. |
data-disabled | boolean | - | Styles Field's label as disabled. Set disabled on the control too. |
htmlFor | string | - | FieldLabel's associated control ID. |
id | string | - | Use on FieldDescription and FieldError to connect them with aria-describedby. |
disabled | boolean | - | Disables controls inside FieldSet using native fieldset semantics. |