Skip to content

Field

Groups a label, a control, help text and an error, and wires their ids for assistive tech.

npx dtheo@latest add field

Overshoot and settling time are compared against this run.

When to use

  • Every form control that needs a label, a description or validation
  • Checkboxes and switches with their own inline label: wrap them in a <label> instead
  • Groups of related controls: use Fieldset with a legend

API

invalid
Field: marks the control invalid and shows a matching FieldError.boolean
optional= false
FieldLabel: adds a quiet "Optional" after the label. Required is the default.boolean
match
FieldError: when to show the message; `true` shows it whenever the field is invalid.boolean | ValidityState key

Other props pass through to Base UI’s Field.

Accessibility

  • The label names the control; the description and error are announced with it.
  • Errors say what happened and how to fix it ("Enter a gain between 0 and 10").
  • Validate on blur or submit, not on every keystroke.

Used in