Content-Length: 297976 | pFad | https://github.com/robertLichtnow/zod-formik-adapter

A6 GitHub - robertLichtnow/zod-formik-adapter: An adapter for zod object validation to Formik validation schema
Skip to content

robertLichtnow/zod-formik-adapter

Repository files navigation

zod-formik-adapter

codecov

This library adapts a zod schema to work as a validationSchema prop or validate prop on Formik

Install

# npm
$ npm install zod-formik-adapter

# yarn
$ yarn add zod-formik-adapter

Usage

import { z } from 'zod';
import { Formik } from 'formik';
import { toFormikValidationSchema } from 'zod-formik-adapter';

const Schema = z.object({
  name: z.string(),
  age: z.number(),
});

const Component = () => (
  <Formik
    validationSchema={toFormikValidationSchema(Schema)}
  >
    {...}
  </Formik>
);
import { z } from 'zod';
import { Formik } from 'formik';
import { toFormikValidate } from 'zod-formik-adapter';

const Schema = z.object({
  name: z.string(),
  age: z.number(),
});

const Component = () => (
  <Formik
    validate={toFormikValidate(Schema)}
  >
    {...}
  </Formik>
);








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/robertLichtnow/zod-formik-adapter

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy