FormField
Status: Experimental
The FormField family standardizes the vertical structure around a native form control without owning form state, validation, submission, or control values.
Family and ownership
Section titled “Family and ownership”FormFieldgroups one field’s visible support content and exposes invalid and disabled styling context.FormLabelrenders a nativelabeland preserves its requiredforrelationship.FormDescriptionrenders supporting text with an authoredid.FormErrorrenders visible error text with an authoredid.- Input, Textarea, Select, Checkbox, Radio, Switch, or an application-owned native control remains responsible for its own
id,aria-describedby,aria-invalid, and native attributes.
This explicit contract survives server rendering and ordinary form submission. The family does not use context, generated IDs, a validation library, or client JavaScript to rewrite slotted controls.
Preview
Section titled “Preview”Used for account notices.
Enter a valid email address.
FormField
Section titled “FormField”| Prop | Type | Default | Purpose |
|---|---|---|---|
as |
"div" | "fieldset" |
"div" |
chooses ordinary field or grouped-control semantics |
invalid |
boolean |
false |
exposes visual invalid context; does not replace aria-invalid |
disabled |
boolean |
false |
exposes visual disabled context; does not disable descendants |
class |
string |
— | styles the root |
When as="fieldset", authors use a native legend for the group name rather than FormLabel.
FormLabel
Section titled “FormLabel”Extends native label attributes. for remains authored and required whenever the label targets a labelable control. The default slot is the label text; an optional required prop adds a visible, non-verbal marker while the control still owns native required and aria-required behavior.
FormDescription
Section titled “FormDescription”Extends native paragraph attributes. Authors provide a stable id and reference it from the control’s aria-describedby.
FormError
Section titled “FormError”Extends native paragraph attributes. Authors provide a stable id and include it in the invalid control’s aria-describedby. An optional announce prop adds role="alert" only for an error inserted or changed after submission; server-rendered initial errors should not announce automatically.
<FormField invalid={Boolean(errors.email)}> <FormLabel for="email" required>Email</FormLabel> <FormDescription id="email-help">Used for account notices.</FormDescription> <Input id="email" name="email" type="email" required invalid={Boolean(errors.email)} aria-describedby={errors.email ? 'email-help email-error' : 'email-help'} /> {errors.email && <FormError id="email-error">Enter a valid email address.</FormError>}</FormField>Usage rules
Section titled “Usage rules”- Do not infer IDs from label text or field names.
- Do not overwrite
aria-describedby; preserve every relevant description and error ID as a space-separated list. invalidstyling never replacesaria-invalid="true"on the control.disabledstyling never replaces the control’s nativedisabledattribute.- Render errors near their control and describe how to resolve the problem.
- Use
fieldsetandlegendfor a related checkbox or radio group.
Responsive behavior
Section titled “Responsive behavior”The default family is a compact vertical stack. Long labels, descriptions, and errors wrap without overlapping controls. Horizontal application layouts may position the label column separately, but DOM order remains label, description/control context, control, then error.
States and errors
Section titled “States and errors”- default, required, disabled, read-only, and invalid controls
- description only, error only, and description plus error
- long and localized content
- grouped radio and checkbox controls
- server-rendered errors and dynamically announced errors
- light and dark themes
Best practices
Section titled “Best practices”- Keep a field’s support content adjacent in the DOM and visually grouped.
- Write descriptions as guidance and errors as actionable corrections.
- Use native
required,disabled, andreadonlybehavior on the actual control. - Do not render an asterisk as the only required-field explanation; establish the form-level convention in nearby copy.

