Usage
Basic Usage
Learn how to use basic zodaf auto-form features
Create form instance
To create a form instance, use the useAutoForm
function from @zodaf/react
package. The createForm
function accepts two arguments:
schema
: A zod schema object that defines the form fields and validation rules.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