Field
Pair a form control with its label, hint, and validation message using the field pattern.
Examples
Use Field.Root when you want a form control to share a label, hint, and validation state. Wrap one control per field. Field.Label and Field.Description provide the control’s label and accessible description; Input, Textarea, and Select.Field read that context.
Input and hint
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxError message
Set invalid on Field.Root after validation. Field.ErrorMessage then appears, and the control receives aria-invalid and a description that includes the error. required and disabled on the root also reach the control.
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxSelect
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxTextarea
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxFieldset
Use Fieldset.Root to group related controls and Fieldset.Legend to name the group. Each nested Field.Root keeps its own label and control association.
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxComponent API
Wrap one form control in Root. Label, Description, and ErrorMessage share the control's validation state.
Root<div>
Supplies field state to nested controls.
| Prop | Type | Description |
|---|---|---|
required | boolean | Requires a value. |
disabled | boolean | Disables the control. |
invalid | boolean | Shows an error state. |
readOnly | boolean | Makes the control read-only. |
| Attribute | Value | Purpose |
|---|---|---|
data-disabled | Present when disabled | Style the disabled state. |
data-invalid | Present when invalid | Style the error state. |
Label<label>
Names the control.
| Attribute | Value | Purpose |
|---|---|---|
data-disabled | Present when disabled | Style the disabled state. |
data-invalid | Present when invalid | Style the error state. |
Description<div>
Provides hint text associated with the control.
ErrorMessage<div>
Provides error text when invalid.
| Attribute | Value | Purpose |
|---|---|---|
data-invalid | Present when invalid | Style the error state. |
Fieldset.Root<fieldset>
Groups related fields under one legend.
| Prop | Type | Description |
|---|---|---|
disabled | boolean | Disables controls in the group. |
invalid | boolean | Marks the group invalid. |
Fieldset.Legend<legend>
Names the group of controls.
Fieldset.Description<div>
Provides supporting text for the group.
Fieldset.ErrorMessage<div>
Displays group-level validation text.
Accessibility
Put one Input, Textarea, Select.Field, or other supported control inside each Field.Root. The field connects its label, hint, and error text to that control.