Form
A native form with consolidated, auto-clearing validation error handling.
Installation
Bash
Usage
API reference
Form
Extends the Base UI Form
primitive — all its props apply. Form renders a native <form> element and
consolidates validation errors for the Fields nested
inside it: entries in errors flow to each field’s <FieldError /> by
name, and clear automatically once that field’s value changes.
| Prop | Type | Default | Description |
|---|---|---|---|
errors | Record<string, string | string[]> | — | Validation errors returned externally (e.g. from a server), keyed by the name on the matching Field. |
onFormSubmit | (values, eventDetails) => void | — | Called on submit with the form’s values. preventDefault() is already called on the native event. |
validationMode | "onSubmit" | "onBlur" | "onChange" | "onSubmit" | When fields validate. A Field’s own validationMode takes precedence. |
There is no onClearErrors handler: errors set via errors clear
automatically once the matching field’s value changes.
All other props accept standard HTML <form> attributes and an optional
className override.