React Hook Form Resolvers
Validation resolvers for React Hook Form supporting Zod, Yup, and others.
3. Used by agents' projects
Dependency in 499 public GitHub projects set up for AI coding agents that we scanned (8.0%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What React Hook Form Resolvers does
It is a set of adapters, not a validator: one package with a separate entry point per library (<code>@hookform/resolvers/zod</code>, <code>/yup</code>, <code>/joi</code> and so on) that plugs the 20 resolvers in its README comparison table into React Hook Form's <code>resolver</code> option.
React Hook Form Resolvers popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How React Hook Form Resolvers is used
- React Hook Form Resolvers is a dependency in 499 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (10.3% of the 4,867 JavaScript/TypeScript ones), #4 of 63 in forms, validation and schemas.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,990; those are left out of every share on this page.
- The most used alternative in our scan is Valibot (33 projects).
- Projects that use it most often also use React Hook Form (99.2%), Zod (98.6%), clsx (92.4%).
- It is more common in projects set up for Roo Code (14.4%) than for OpenCode (4.7%).
By coding agent
Often used with
React Hook Form Resolvers in practice
Strengths
You add this package beside your existing validation library. Each library has its own import path, such as <code>@hookform/resolvers/zod</code> or <code>@hookform/resolvers/yup</code>.
With a resolver that supports inference, <code>useForm</code> needs no generic. The README's Zod example passes only <code>zodResolver(schema)</code>, and the output type is inferred.
Each resolver takes the schema, optional library-specific schema options, and resolver options. The resolver options choose <code>sync</code> or <code>async</code> mode. The README says <code>async</code> is the default.
The README's comparison table has a <code>criteriaMode</code> column. It marks <code>firstError | all</code> for Zod, Yup, Valibot, Effect, Standard Schema, class-validator, TypeBox, VineJS, AJV, joi, vest and others.
Watch out for
The README's table marks AJV, ata-validator, fluentvalidation-ts, joi, Nope, typeschema and vest as not inferring values from the schema. It marks Arktype, computed-types, fluentvalidation-ts, io-ts, Nope, Superstruct and typanion as <code>firstError</code> only. Check the table before you pick a library.
A Zod field with <code>.default(...)</code> is optional on the input type but required on the output type. Writing <code>useForm<T></code> with one type then conflicts with <code>zodResolver</code>. The README says to omit the generic or pass all three.
Context passed through <code>yupResolver</code>'s <code>schemaOptions</code> is overridden by the form context. The README says to put it in <code>useForm({ context })</code> instead.
Zod schema wired into useForm
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod'; // or 'zod/v4'
const schema = z.object({
name: z.string().min(1, { message: 'Required' }),
age: z.number().min(10),
});
const App = () => {
const {
register,
handleSubmit,
formState: { errors },
} = useForm({
resolver: zodResolver(schema),
});
return (
<form onSubmit={handleSubmit((d) => console.log(d))}>
<input {...register('name')} />
{errors.name?.message && <p>{errors.name?.message}</p>}
<input type="number" {...register('age', { valueAsNumber: true })} />
{errors.age?.message && <p>{errors.age?.message}</p>}
<input type="submit" />
</form>
);
};More about React Hook Form Resolvers
Funding
- GitHub Sponsors: https://github.com/bluebill1049
- GitHub Sponsors: https://github.com/jorisre
- Patreon: https://patreon.com/bluebill1049
- Open Collective: https://opencollective.com/react-hook-form
- 7 GitHub sponsors
Packages around it
- @hookform/error-message: Form error message component
- @hookform/devtools: Form devtools
- react-hook-form: Form state hook
- zod: Schema validation
- clsx: Class name builder
- lucide-react: Icons
More in Forms, validation and schemas
Alternatives
React Hook Form Resolvers This page
Modular and type-safe schema validation library for structural data with minimal bundle size.
Simple schema validation library for JavaScript with chainable API and error handling.
Popular React form state management library with validation and submission handling.
Get started
Install it.
npm install @hookform/resolversRules for your agent
## React Hook Form Resolvers
- Install `@hookform/resolvers` alongside the validation library, and import the resolver from its subpath, e.g. `import { zodResolver } from '@hookform/resolvers/zod'`.
- Pass the resolver as `useForm({ resolver: zodResolver(schema) })`. Omitting the generic lets the form types be inferred from the resolver.
- If a Zod schema uses `.default(...)` on a field, do not pass a single generic `useForm<T>`. Either omit the generic or pass all three: `useForm<z.input<typeof schema>, unknown, z.output<typeof schema>>`.
- For Yup, pass context via `useForm({ context })`, not via `yupResolver`'s `schemaOptions.context`, which is overridden.
- `register('age', { valueAsNumber: true })` requires react-hook-form v6.12.0 or later.
- Only set `criteriaMode: 'all'` with resolvers the README table lists as supporting `all`. The default is `firstError`.
- With class-validator, set `"strictPropertyInitialization": false` and `"experimentalDecorators": true` in `tsconfig.json`. With Ajv, use `minLength: 1` to implement a required field.