Skip to content

Form

Groups fields and handles validation and submission.

form-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Composition

  • Form
    • TextField

      Install each field separately.

    • Button

      Set type="submit".

Custom validation

Return an error message from validate, or null when the value is valid.

Use 3 or more characters.
form-validation-demo.tsx

Server errors

Pass server errors to validationErrors, keyed by field name. Push Save with "maya" to see one.

form-server-errors-demo.tsx

API reference

Form takes the props of React Aria Form (opens in a new tab).