Installation
- CLI
- Manual
Usage
Anatomy
TheField family is designed for composing accessible forms. A typical field is structured as follows:
Field.Fieldis the core wrapper for a single field.Field.Contentis a flex column that groups label and description. Not required if you have no description.- Wrap related fields with
Field.Group, and useField.SetwithField.Legendfor semantic grouping.
Examples
Input
Example showing field with input component.Textarea
Example showing field with textarea component.Select
Example showing field with select component.Slider
Example showing field with slider component.Fieldset
Example showing field with fieldset.Checkbox
Example showing field with checkbox component.Radio
Example showing field with radio component.Switch
Example showing field with switch component.Choice Card
WrapField components inside FieldLabel to create selectable field groups. This works with RadioItem, Checkbox and Switch components.
Field Group
StackField components with Field.Group. Add Field.Separator to divide them.
Responsive Layout
- Vertical fields: Default orientation stacks label, control, and helper text—ideal for mobile-first layouts.
- Horizontal fields: Set
orientation="horizontal"onFieldto align the label and control side-by-side. Pair withField.Contentto keep descriptions aligned. - Responsive fields: Set
orientation="responsive"for automatic column layouts inside container-aware parents. Apply@container/field-groupclasses onField.Groupto switch orientations at specific breakpoints.
Validation and Errors
- Add
data-invalidtoFieldto switch the entire block into an error state. - Add
aria-invalidon the input itself for assistive technologies. - Render
FieldErrorimmediately after the control or insideFieldContentto keep error messages aligned with the field.
Accessibility
Field.SetandField.Legendkeep related controls grouped for keyboard and assistive tech users.Fieldoutputsrole="group"so nested controls inherit labeling fromField.LabelandField.Legendwhen combined.- Apply
Field.Separatorsparingly to ensure screen readers encounter clear section boundaries.