Skip to content

Form

Free

A form around its fields. It sets when every field checks its value, shows server errors on the right field, and gives your submit the values.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

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>
PropTypeDefaultDescription
classNamestring—
From Base UIFormBase UI docs
validationMode"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.
errorsErrors—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.
onFormSubmit—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.
  • Use it around the fields of one task, with the submit Button in the last row.
  • Put each control in a Field with a name. onFormSubmit gets the values as an object by that name.
  • Pass the errors of the server in errors, by field name. Each error shows until the user changes the value.
  • validationMode sets one mode for every field: onBlur (the default), onChange, or onSubmit. A Field with its own mode keeps it.
  • For one control outside a form, with its label, help, and error, use a Field.
EnterSends the form from a text field. When a field is invalid, the focus moves to the first invalid field.

Form is a Base UI Form, a native <form>. Put each control in a Field, so its label, help, and error link to it for screen readers.

When a submit finds an invalid field, the focus moves to the first invalid field. A screen reader then reads its name and its error.

An error from errors shows in the FieldError of its field and links to the control, the same as an error of the browser check.

Give the submit Button loading while the request runs. It sets aria-busy, keeps the focus, and blocks a second press.

Built with

Installs with Form

Components
Field
  1. AddedForm, with Field.
Open the release