Form
A form is used to collect and validate user input, commonly used in web applications.
Installation
Usage
The Form
component is a wrapper around react-hook-form
that simplifies building forms with validation and accessibility.
Features
The Form
component offers:
- Composable components for building forms.
- Controlled form fields via
FormField
. - Integration with
react-hook-form
for form state management. - Validation support using Zod.
- Accessibility features like aria attributes and proper labeling.
- Flexibility to style forms with any design system.
- Built-in support for Radix UI components.
- Works with various schema libraries (e.g., Zod).
Props
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | null | Form content, including form fields and buttons. |
onSubmit | (data: any) => void | null | The function to handle form submission. |
...props | React.FormHTMLAttributes<HTMLFormElement> | null | Additional HTML attributes for the form element. |