Skip to main content

Introduction

Create form instance

For this tutorial, we will start from a basic zodaf form example, to learn how to create a basic zodaf from, please refer to the Basic Usage guide.
app/page.tsx
image

Basic Features

Customizing form fields

You can easily customize form fields by passing a config object to the useAutoForm function. The config can take the following properties:
Record<keyof schema, ZodafFieldConfig>
Object that defines the form fields configuration. The key is the field name and the value is a ZodafFieldConfig object.Example:
See the configuration section for more details.

Handling form events

Function
Function that is called when the form is submitted. The function receives the type-safe form data as an argument.Example:
Function
Function that is called when the form has changes. The function receives the type-safe form data as an argument.Example:
string
Label for the submit button.Example:
Note: Ensure that the submitLabel is used with a submit component that supports a children prop.
boolean
Hide the submit button. Defaults to false.Example:
Component will render without a submit button.