Form

A form is a group of inputs that allows users to submit data to a server, with support for providing field validation errors.

Example

Features

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.

  • Accessible – Uses a native <form> element, with support for ARIA labelling to create a form landmark.
  • Validation – Support for native HTML constraint validation with customizable UI, custom validation functions, realtime validation, and server-side validation errors. See the Forms guide to learn more about React Aria's form components, including submitting data, and form validation techniques.

Installation

Install following dependencies:

npm install react-aria-components tw-animate-css tailwindcss-react-aria-components class-variance-authority lucide-react clsx tailwind-merge motion

Add cn helper using clsx and twMerge for conditional class merging in Tailwind components.

lib/utils.ts

Copy and paste the following code into your project.

components/ui/core/form.tsx
npx @libravelui@latest add form

Another Example

Grid