A form automatically created based simply on a zod schema. Perfect for simple forms that don't need custom UI. Also perfect for testing endpoints rapidly in a Typesafe manner.
<AutoForm />
automatically detects when an object is provided, allowing it to be used for both creating and updating data. This means you can seamlessly create a new object or update an existing one using the same AutoForm
component. Here is an example with a simple user:
This is an example of what you can do with <AutoForm />
.
You can use arrays in your schemas to create dynamic forms.
<AutoForm />
also provides additional support for Array primitives (tags and multi-select).
The original idea of the <AutoForm />
component comes from the auto-form by vantezzen.
Credit to vozmarkov for the implementation of Array Primitives.
We've added some features (mode, resetOnSubmit, noValidate, etc.) and simplified the code. Enjoy!
Run the following command: