formik-adapter-zod
v1.1.2
Published
An adapter of zod object validation to Formik validation schema
Downloads
4
Readme
formik-adapter-zod
Works with react v18
This library adapts a zod schema to work as a validationSchema
prop on Formik
IMPORTANT: Currently, this library does not work with zod union. See more here.
Install
# npm
$ npm install formik-adapter-zod
# yarn
$ yarn add formik-adapter-zod
Usage
import { z } from 'zod';
import { Formik } from 'formik';
import { toFormikValidationSchema } from 'formik-adapter-zod';
const Schema = z.object({
name: z.string(),
age: z.number(),
});
const Component = () => (
<Formik
validationSchema={toFormikValidationSchema(Schema)}
>
{...}
</Formik>
);