Skip to content

Repository files navigation

React Hook Form Logo - React hook custom hook for form validation

Performant, flexible and extensible forms with easy to use validation.

CircleCInpm downloadsnpmdepnpmCoverage Status

TweetJoin the community on Spectrum

React Hook Form video - React custom hook for form validation

🇦🇺English | 🇷🇺Русский | 🇨🇳 简体中文 | 🇯🇵 日本語 | 🇰🇷한국어 | 🇫🇷Français | 🇮🇹Italiano | 🇧🇷Português | 🇪🇸Español

Features

  • Built with performance and DX in mind
  • Embrace uncontrolled form validation
  • Improve controlled form's performance
  • Tiny size without any dependency
  • Follows HTML standard for validation
  • Compatible with React Native
  • Supports Yup schema-based validation
  • Supports native browser validation
  • Build forms quickly with the form builder

Install

$ npm install react-hook-form

Links

Quickstart

importReactfrom'react';import{useForm}from'react-hook-form';functionApp(){const{ register, handleSubmit, errors }=useForm();// initialise the hookconstonSubmit=data=>{console.log(data);};return(<formonSubmit={handleSubmit(onSubmit)}><inputname="firstname"ref={register}/>{/* register an input */}<inputname="lastname"ref={register({required: true})}/>{errors.lastname&&'Last name is required.'}<inputname="age"ref={register({pattern: /\d+/})}/>{errors.age&&'Please enter number for age.'}<inputtype="submit"/></form>);}

Backers

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

Contributors

Thanks goes to these wonderful people. [Become a contributor].

About

📋 React hooks for forms validation without the hassle.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages