Complete Usage
Learn how to use all zodaf auto-form features for more advanced use cases
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.
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:
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 that is called when the form is submitted. The function receives the type-safe form data as an argument.
Example:
Function that is called when the form has changes. The function receives the type-safe form data as an argument.
Example:
Label for the submit button.
Example:
Note: Ensure that the submitLabel is used with a submit component that supports a children prop.
Hide the submit button.
Defaults to false
.
Example:
Component will render without a submit button.