1.1.2 • Published 1 year ago

formik-adapter-zod v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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>
);
1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago