onFormSubmit gets the values as an object by field name. Put the errors of the server in errors: each shows in the FieldError of its field until the user changes the value.
The sample also uses Button and Input. One command adds them with this item:
invite-form.tsx
Form
<form>| Prop | Type | Default | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||
From Base UIFormBase UI docs | |||||||||||||||||||||
| validation | "onBlur""onChange""onSubmit" | "onBlur" | Determines when the form should be validated. The validationMode prop on <Field.Root> takes precedence over this. - onSubmit (default): validates the field when the form is submitted, afterwards fields will re-validate on change. - onBlur: validates a field when it loses focus. - onChange: validates the field on every change to its value. | ||||||||||||||||||
| errors | Errors | — | Validation errors returned externally, typically after submission by a server or a form action. This should be an object where keys correspond to the name attribute on <Field.Root>, and values correspond to error(s) related to that field. | ||||||||||||||||||
| on | — | Event handler called when the form is submitted. preventDefault is called on the native submit event when used. | |||||||||||||||||||
| |||||||||||||||||||||
| ...props | <form> attributes | — | Every other attribute goes to the <form>, with a ref. | ||||||||||||||||||
| Enter | Sends the form from a text field. When a field is invalid, the focus moves to the first invalid field. |
|---|
Built with
Installs with Form
- Components
- Field







