Skip to main content

Create form instance

To create a form instance, use the useAutoForm function from @zodaf/react package. The createForm function accepts two arguments:
  1. schema: A zod schema object that defines the form fields and validation rules.
  2. config: An object that defines the form configuration. This is optional.
app/page.tsx

Rendering form

To render the form, use the AutoForm component from @zodaf/react package. The AutoForm component accepts the form instance as a prop.
app/page.tsx

Full code

app/page.tsx

Result

image