Field
The form-layout system — label, control, description and error.
Overview
Field is how forms are laid out in Morpha UI: each Field stacks a label, a
control, an optional description and an error slot with consistent spacing;
FieldGroup spaces fields; FieldSet + FieldLegend group related choices.
Orientation can be vertical, horizontal (checkboxes, switches) or
responsive (container-query driven).
Coming from shadcn? The legacy react-hook-form form component was
replaced upstream by this Field family — Morpha UI adopts Field directly and
ships no form component. Field is library-agnostic: pass any form
library's errors to FieldError.
Shown on your public profile.
$ npx morpha-ui add fieldExamples
Validation
Set aria-invalid on the control and state="error" on the InputGroup — it
recolors the ring and shows the trailing alert. The error message replaces the
supporting text (use InputGroupSupportingText error), so only one caption line
ever shows.
Enter a valid email address.
Choice groups
Installation
Morpha UI components are distributed via the Morpha CLI: npx morpha-ui add field. In the meantime, since this is the base shadcn component, you can
also add it directly:
npx shadcn@latest add fieldAPI Reference
Prop
Type
Accessibility
Fieldrendersrole="group";FieldSet/FieldLegenduse nativefieldset/legendsemantics.- Always pair
FieldLabel htmlForwith the controlid. FieldErrorrendersrole="alert"so validation messages are announced; also setaria-invalidon the control.