The zod validation adapter for form management with Preact Signals.
- TypeScript - Written in TypeScript with full type support for optimal DX.
- Reactivity - Reactivity without abstractions thanks to Preact Signals.
- Validation - Built-in validation support, including adapters for validation schema libraries.
- Transformations - Transform values for the specific needs of your input fields.
- Async Data - Easily manage async initialisation, validation and submission.
- Arrays + Dynamic Objects - Utilize arrays and dynamic objects within your forms.
npm install @formsignals/validation-adapter-zod
If you have not installed zod yet, you will need to install it as well:
npm install zod
A form or field needs to receive a validation adapter during configuration to be able to use zod schemas.
const form = new FormLogic({
defaultValues: {
name: '',
email: '',
},
validationAdapter: ZodAdapter,
});
Then you can create a field instance and configure it with a zod schema:
const nameField = form.getOrCreateField('name', {
validate: Zod.string().min(3),
});