Form
Accessible form composition built on the Field system — auto-wired ids, invalid states, and alert-announced errors with zero dependencies.
Installation#
pnpm dlx shadcn@latest add @davinciui/formUsage#
Composition#
Use the following composition to build a Form:
Form
└── FormItem
├── FormLabel
├── FormControl
├── FormDescription
└── FormMessageAPI Reference#
| Prop | Type | Default |
|---|---|---|
FormRoot form element. | Component | — |
FormItemItem wrapper with label/control/message. Prop: invalid — shared with the message. | Component | — |
FormLabelLabel; htmlFor auto-links to the control. | Component | — |
FormControlControl container; auto-injects id, aria-invalid, and aria-describedby into its child. | Component | — |
FormMessageValidation message with role=alert and error icon. | Component | — |
FormDescriptionHelper description with a stable id for aria-describedby. | Component | — |
classNameAdditional CSS classes. | string | — |
Accessibility#
FieldContext generates stable ids and auto-wires labels via htmlFor, plus aria-invalid and aria-describedby on the control. FormMessage renders role=alert with an icon, so errors are announced; behavior otherwise relies on native form and input semantics.
Motion#
Static composition primitive with no animation, transitions or timing props. It does not check prefers-reduced-motion because it has no motion to reduce.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

