Skip to main content
Forms can be displayed inside dialogs using components returned from useForm(), which is given a form schema.

How to build a form

The process to build a form is:
  1. Create a form schema.
  2. Destructure the form components you need from useForm().
  3. Render the components. Wrap your form inputs in a <Form/>.
  4. Define your onSubmit function in <Form/>.

Example: Simple Form

simple-form.tsx

Example: Complex validation

Sometimes you may need to add more complex validation than a static schema can express. For example, you might want to ensure that the minimum value is less than the maximum value. You can achieve this by passing a validation function to useForm().
complex-validation.tsx