FO

Formik

formik

Build forms in React, without the tears

Forms
formik
form
forms
react
react-dom
hooks
react hooks
validation
render props
higher order component
Stars
34k
Weekly
3.9M
Open issues
840
Bundle
~25 kB

Installation

npm install formik

Code example

import { Formik, Form, Field } from "formik";

export function Example() {
  return (
    <Formik
      initialValues={{ email: "" }}
      onSubmit={(values) => console.log(values)}
    >
      <Form>
        <Field name="email" type="email" placeholder="you@example.com" />
        <button type="submit">Submit</button>
      </Form>
    </Formik>
  );
}

Pros & cons

Pros

  • Actively maintained by Jared Palmer
  • 3.9M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • Apache-2.0 licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 840 open issues on GitHub

FAQs

Alternatives & similar libraries