MCPcopy
hub / github.com/react-hook-form/react-hook-form

github.com/react-hook-form/react-hook-form @v7.80.0 sqlite

repository ↗ · DeepWiki ↗ · release v7.80.0 ↗
635 symbols 3,106 edges 413 files 7 documented · 1%
README
    <a href="https://react-hook-form.com" title="React Hook Form - Simple React forms validation">
        <img src="https://raw.githubusercontent.com/react-hook-form/react-hook-form/master/docs/logo.png" alt="React Hook Form Logo - React hook custom hook for form validation" />
    </a>

npm downloads npm npm Discord

Get started | API | Form Builder | FAQs | Examples

Features

Install

npm install react-hook-form

Quickstart

import { useForm } from 'react-hook-form';

function App() {
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm();

  return (
    <form onSubmit={handleSubmit((data) => console.log(data))}>
      <input {...register('firstName')} />
      <input {...register('lastName', { required: true })} />
      {errors.lastName && 

Last name is required.

}
      <input {...register('age', { pattern: /\d+/ })} />
      {errors.age && 

Please enter number for age.

}
      <input type="submit" />
    </form>
  );
}

Sponsors

We’re incredibly grateful to these kind and generous sponsors for their support!

Major Sponsors

Follower24 BuyFans

Supporting Sponsors

Thanks.dev Workleap Kinsta Sent Niche
Toss Principal Hygraph

Past Sponsors

Thank you to our previous sponsors for your generous support!

Backers

Thanks go to all our backers! [Become a backer].

Contributors

Thanks go to these wonderful people! [Become a contributor].

Documentation website supported and backed by Vercel

Extension points exported contracts — how you extend this code

File (Interface)
(no doc)
src/types/utils.ts
Base (Interface)
(no doc)
src/__typetest__/__fixtures__/traversable.ts
FormData (Interface)
(no doc)
src/__tests__/useWatch.test.tsx
FileList (Interface)
(no doc)
src/types/utils.ts
Nested (Interface)
(no doc)
src/__typetest__/__fixtures__/traversable.ts
FormData (Interface)
(no doc)
src/__tests__/type.test.tsx
ResolverOptions (Interface)
(no doc)
src/types/resolvers.ts
InputProps (Interface)
(no doc)
src/__tests__/type.test.tsx

Core symbols most depended-on inside this repo

useForm
called by 995
src/useForm.ts
register
called by 976
src/logic/createFormControl.ts
useFieldArray
called by 271
src/useFieldArray.ts
handleSubmit
called by 246
src/logic/createFormControl.ts
setValue
called by 131
src/logic/createFormControl.ts
append
called by 123
src/useFieldArray.ts
watch
called by 98
src/logic/createFormControl.ts
reset
called by 88
src/logic/createFormControl.ts

Shape

Function 614
Interface 12
Class 6
Method 3

Languages

TypeScript100%

Modules by API surface

src/logic/createFormControl.ts56 symbols
src/__tests__/useFieldArray.test.tsx22 symbols
src/__tests__/useWatch.test.tsx20 symbols
src/__tests__/useController.test.tsx13 symbols
src/useFieldArray.ts10 symbols
src/__tests__/useForm.test.tsx10 symbols
src/__tests__/useFormState.test.tsx9 symbols
src/__tests__/useFormContext.test.tsx9 symbols
src/__tests__/useForm/resolver.test.tsx9 symbols
src/__tests__/formStateSubscribe.test.tsx9 symbols
src/__tests__/controller.test.tsx9 symbols
scripts/bench-compare.ts9 symbols

Dependencies from manifests, versioned

@emotion/react11.14.0 · 1×
@emotion/styled11.14.0 · 1×
@eslint/compat1.4.1 · 1×
@hookform/resolvers3.9.0 · 1×
@microsoft/api-extractor7.58.9 · 1×
@mui/material5.16.13 · 1×
@rollup/plugin-commonjs28.0.9 · 1×
@rollup/plugin-node-resolve16.0.3 · 1×
@rollup/plugin-terser0.4.4 · 1×
@swc/core1.15.41 · 1×
@swc/jest0.2.39 · 1×
@testing-library/jest-dom6.9.1 · 1×

For agents

$ claude mcp add react-hook-form \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact