- Docs
- components
- Form
Form
A form is a group of inputs that allows users to submit data to a server, with support for providing field validation errors.
The HTML <form>
element can be used to build forms. React Aria's Form component extends HTML forms with support for providing server-side validation errors to the fields within it.
Installation
Copy and paste the following code into your project: field.tsx
Loading...
Update the import paths to match your project setup.
Examples
Basic
Validation
Validation Behavior
By default, native HTML form validation is used to display errors and block form submission. To instead use ARIA attributes for form validation, set the validationBehavior prop to "aria". This will not block form submission, and will display validation errors to the user in realtime as the value is edited.
The validationBehavior can be set at the form level to apply to all fields, or at the field level to override the form's behavior for a specific field.