formik vs react-final-form vs @jsonforms/react vs react-jsonschema-form vs uniforms vs react-hook-form
React Form Libraries
formikreact-final-form@jsonforms/reactreact-jsonschema-formuniformsreact-hook-formSimilar Packages:
React Form Libraries

React form libraries provide tools and components to help developers create, manage, and validate forms in React applications. These libraries offer various features such as state management, validation, and integration with UI frameworks, making it easier to handle user input and form submission. They help streamline the development process, improve code readability, and enhance the user experience by providing efficient and scalable solutions for form handling in React applications.

Npm Package Weekly Downloads Trend
3 Years
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
formik3,492,11934,381585 kB8363 months agoApache-2.0
react-final-form465,9837,439215 kB3758 months agoMIT
@jsonforms/react122,9662,640285 kB1563 months agoMIT
react-jsonschema-form55,38815,645-1886 years agoApache-2.0
uniforms15,9322,092224 kB29a year agoMIT
react-hook-form044,5281.25 MB120a month agoMIT
Feature Comparison: formik vs react-final-form vs @jsonforms/react vs react-jsonschema-form vs uniforms vs react-hook-form

Schema Support

  • formik:

    formik does not natively support schema-based form generation. However, it can be integrated with schema validation libraries like Yup to provide schema-based validation. This allows developers to define validation rules in a schema-like format, which Formik can then use to validate form fields.

  • react-final-form:

    react-final-form does not provide built-in support for schema-based form generation or validation. It focuses on providing a flexible and performant form state management solution, allowing developers to implement their own validation logic as needed. Schema-based validation can be integrated manually or through third-party libraries.

  • @jsonforms/react:

    @jsonforms/react provides comprehensive support for JSON Schema, allowing for the creation of complex and nested forms based on schema definitions. It supports all standard JSON Schema features, including validation, default values, and custom formats. The library is designed to be highly extensible, enabling developers to create custom renderers and validators as needed.

  • react-jsonschema-form:

    react-jsonschema-form is built around JSON Schema, automatically generating forms based on the provided schema. It supports all standard JSON Schema features, including validation, default values, and nested structures. The library also allows for customization of the generated forms through UI schema definitions and custom widgets.

  • uniforms:

    uniforms supports multiple schema formats, including JSON Schema, GraphQL, and SimpleSchema. It allows for automatic form generation based on the provided schema, with support for nested structures, validation, and default values. The library is highly customizable, enabling developers to create custom components and widgets while leveraging the schema for form rendering and validation.

  • react-hook-form:

    react-hook-form does not natively support schema-based form generation but offers seamless integration with schema validation libraries like Yup, Zod, and Joi. This allows developers to define validation schemas externally and use them within the form, ensuring a clear separation of concerns and more maintainable code.

Validation

  • formik:

    formik provides built-in support for validation through its validate function and integration with third-party validation libraries like Yup. It allows for both synchronous and asynchronous validation, with support for field-level, form-level, and schema-based validation. Formik also provides tools for displaying validation errors and managing form state during validation.

  • react-final-form:

    react-final-form offers flexible validation capabilities, allowing developers to implement field-level, form-level, and asynchronous validation. It provides a simple API for defining validation functions and integrates well with third-party validation libraries. The library also supports real-time validation and error handling, with tools for displaying validation messages and managing form state.

  • @jsonforms/react:

    @jsonforms/react supports validation based on JSON Schema, including required fields, data types, and custom validation rules. It allows for real-time validation and error display, with the ability to customize error messages and validation logic. The library also supports asynchronous validation and integration with external validation services.

  • react-jsonschema-form:

    react-jsonschema-form uses JSON Schema for validation, automatically enforcing rules defined in the schema, such as required fields, data types, and custom validation keywords. It provides real-time validation feedback and error messages, which can be customized through the UI schema or by providing custom error templates.

  • uniforms:

    uniforms supports validation based on the provided schema, including required fields, data types, and custom validation rules. It allows for real-time validation and error display, with support for asynchronous validation and integration with external validation libraries. The library also provides tools for customizing validation messages and handling complex validation scenarios.

  • react-hook-form:

    react-hook-form provides built-in validation support, including required fields, min/max values, and pattern matching. It also integrates seamlessly with external validation libraries like Yup, allowing for schema-based validation. The library is designed to minimize re-renders during validation, making it highly performant for large forms.

Customization

  • formik:

    formik offers a high degree of customization, allowing developers to control the form structure, styling, and validation logic. It provides a simple API for managing form state, making it easy to integrate with custom components and third-party libraries. Formik also supports custom input components, error messages, and form layouts.

  • react-final-form:

    react-final-form is designed to be highly customizable, providing fine-grained control over form state, validation, and rendering. It allows developers to create custom input components, validation logic, and form layouts. The library's modular architecture makes it easy to extend and integrate with other tools and libraries.

  • @jsonforms/react:

    @jsonforms/react is highly customizable, allowing developers to create custom renderers, layouts, and validation logic. It provides a flexible architecture that supports the integration of third-party UI libraries and components. The library also allows for theming and styling, making it easy to adapt the forms to match the application's design.

  • react-jsonschema-form:

    react-jsonschema-form allows for customization of the generated forms through UI schema definitions, which control the layout, styling, and behavior of the form elements. Developers can also create custom widgets and field templates to replace the default components, providing greater flexibility in how the forms are rendered.

  • uniforms:

    uniforms is highly customizable, allowing developers to create custom components, widgets, and layouts while leveraging the schema for form generation. It supports theming and styling, making it easy to integrate with various UI frameworks. The library's flexibility makes it suitable for complex forms that require specialized behavior and appearance.

  • react-hook-form:

    react-hook-form is highly customizable, allowing developers to create custom input components, validation rules, and error messages. It provides a flexible API for managing form state and integrates well with third-party libraries and UI frameworks. The library also supports theming and styling, making it easy to adapt forms to different design requirements.

Performance

  • formik:

    formik is generally performant for most use cases, but it can suffer from unnecessary re-renders, especially in large forms with many fields. Developers need to be careful with how they structure their forms and may need to use techniques like memoization to optimize performance.

  • react-final-form:

    react-final-form is optimized for performance, with a focus on minimizing re-renders and managing form state efficiently. It uses a subscription-based model that allows components to only re-render when the specific parts of the form state they depend on change, making it ideal for large and complex forms.

  • @jsonforms/react:

    @jsonforms/react is designed to be efficient, but performance can vary depending on the complexity of the JSON schema and the number of custom renderers used. The library leverages React's rendering optimizations, but developers should be mindful of potential performance bottlenecks when working with large or deeply nested schemas.

  • react-jsonschema-form:

    react-jsonschema-form performance depends on the complexity of the JSON schema and the number of fields in the form. While it is generally efficient, rendering large or deeply nested forms can lead to performance issues. Developers should optimize schemas and use techniques like lazy loading or code splitting for complex forms.

  • uniforms:

    uniforms is designed for performance, but the impact depends on the complexity of the schema and the number of custom components used. The library leverages React's rendering optimizations, but developers should be mindful of potential performance issues when working with large or deeply nested forms.

  • react-hook-form:

    react-hook-form is built with performance in mind, leveraging uncontrolled components and refs to minimize re-renders. It is one of the most performant form libraries for React, especially for large forms, as it only triggers re-renders when necessary, resulting in faster and more efficient form handling.

Ease of Use: Code Examples

  • formik:

    formik Example

    import React from 'react';
    import { Formik, Form, Field, ErrorMessage } from 'formik';
    import * as Yup from 'yup';
    
    const validationSchema = Yup.object({
      name: Yup.string().required('Name is required'),
      email: Yup.string().email('Invalid email').required('Email is required'),
    });
    
    const App = () => (
      <Formik
        initialValues={{ name: '', email: '' }}
        validationSchema={validationSchema}
        onSubmit={(values) => {
          console.log(values);
        }}
      >
        {() => (
          <Form>
            <div>
              <label htmlFor="name">Name</label>
              <Field id="name" name="name" />
              <ErrorMessage name="name" />
            </div>
            <div>
              <label htmlFor="email">Email</label>
              <Field id="email" name="email" type="email" />
              <ErrorMessage name="email" />
            </div>
            <button type="submit">Submit</button>
          </Form>
        )}
      </Formik>
    );
    
    export default App;
    
  • react-final-form:

    react-final-form Example

    import React from 'react';
    import { Form, Field } from 'react-final-form';
    
    const validate = (values) => {
      const errors = {};
      if (!values.name) {
        errors.name = 'Name is required';
      }
      if (!values.email) {
        errors.email = 'Email is required';
      }
      return errors;
    };
    
    const App = () => (
      <Form
        onSubmit={(values) => {
          console.log(values);
        }}
        validate={validate}
        render={({ handleSubmit }) => (
          <form onSubmit={handleSubmit}>
            <div>
              <label>Name</label>
              <Field name="name" />
            </div>
            <div>
              <label>Email</label>
              <Field name="email" type="email" />
            </div>
            <button type="submit">Submit</button>
          </form>
        )}
      />
    );
    
    export default App;
    
  • @jsonforms/react:

    @jsonforms/react Example

    import React from 'react';
    import { JsonForms } from '@jsonforms/react';
    import { materialRenderers } from '@jsonforms/material-renderers';
    
    const schema = {
      type: 'object',
      properties: {
        name: { type: 'string' },
        age: { type: 'integer' },
      },
      required: ['name'],
    };
    
    const uischema = {
      type: 'VerticalLayout',
      elements: [
        { type: 'Control', scope: '#/properties/name' },
        { type: 'Control', scope: '#/properties/age' },
      ],
    };
    
    const App = () => {
      const [data, setData] = React.useState({});
    
      return (
        <JsonForms
          schema={schema}
          uischema={uischema}
          data={data}
          onChange={({ data }) => setData(data)}
          renderers={materialRenderers}
        />
      );
    };
    
    export default App;
    
  • react-jsonschema-form:

    react-jsonschema-form Example

    import React from 'react';
    import Form from '@rjsf/core';
    
    const schema = {
      title: 'Example Form',
      type: 'object',
      required: ['name', 'email'],
      properties: {
        name: { type: 'string', title: 'Name' },
        email: { type: 'string', format: 'email', title: 'Email' },
      },
    };
    
    const App = () => {
      const onSubmit = ({ formData }) => {
        console.log('Data submitted: ', formData);
      };
    
      return <Form schema={schema} onSubmit={onSubmit} />;
    };
    
    export default App;
    
  • uniforms:

    uniforms Example

    import React from 'react';
    import { AutoForm } from 'uniforms-unstyled';
    import { JSONSchemaBridge } from 'uniforms-bridge-json-schema';
    import { createValidator } from 'uniforms-bridge-simple-schema';
    
    const schema = {
      title: 'Example Form',
      type: 'object',
      properties: {
        name: { type: 'string', title: 'Name' },
        email: { type: 'string', format: 'email', title: 'Email' },
      },
      required: ['name', 'email'],
    };
    
    const validator = createValidator(schema);
    const bridge = new JSONSchemaBridge(schema, validator);
    
    const App = () => {
      const handleSubmit = (data) => {
        console.log('Form submitted:', data);
      };
    
      return <AutoForm schema={bridge} onSubmit={handleSubmit} />;
    };
    
    export default App;
    
  • react-hook-form:

    react-hook-form Example

    import React from 'react';
    import { useForm } from 'react-hook-form';
    
    const App = () => {
      const { register, handleSubmit, formState: { errors } } = useForm();
    
      const onSubmit = (data) => {
        console.log(data);
      };
    
      return (
        <form onSubmit={handleSubmit(onSubmit)}>
          <div>
            <label>Name</label>
            <input {...register('name', { required: 'Name is required' })} />
            {errors.name && <p>{errors.name.message}</p>}
          </div>
          <div>
            <label>Email</label>
            <input
              type="email"
              {...register('email', {
                required: 'Email is required',
                pattern: {
                  value: /^[^@\s]+@[^@\s]+\.[^@\s]+$/,
                  message: 'Invalid email address',
                },
              })}
            />
            {errors.email && <p>{errors.email.message}</p>}
          </div>
          <button type="submit">Submit</button>
        </form>
      );
    };
    
    export default App;
    
How to Choose: formik vs react-final-form vs @jsonforms/react vs react-jsonschema-form vs uniforms vs react-hook-form
  • formik:

    Choose formik if you want a simple yet powerful form management library that integrates well with React. It is suitable for applications that need straightforward form handling with built-in validation, error handling, and support for third-party validation libraries like Yup.

  • react-final-form:

    Choose react-final-form if you need a lightweight and performant form library with fine-grained control over form state. It is ideal for applications that require advanced features like field-level validation, dynamic forms, and optimized rendering, while keeping the bundle size small.

  • @jsonforms/react:

    Choose @jsonforms/react if you need a highly customizable and extensible form rendering solution that supports complex JSON schemas. It is ideal for applications that require dynamic form generation based on JSON data, with support for custom renderers and validation.

  • react-jsonschema-form:

    Choose react-jsonschema-form if you need a form generator that automatically creates forms based on JSON schemas. It is perfect for applications that require quick form creation from schema definitions, with support for validation and customization.

  • uniforms:

    Choose uniforms if you want a highly customizable form library that supports multiple schema formats (JSON Schema, GraphQL, SimpleSchema). It is ideal for applications that need flexible form generation with support for various UI frameworks and advanced features like nested forms and custom widgets.

  • react-hook-form:

    Choose react-hook-form if you prioritize performance and minimal re-renders. It leverages React hooks for form management, making it a great choice for modern React applications that need efficient form handling with minimal boilerplate.

README for formik

Formik.js

Build forms in React, without the tears.


Stable Release Blazing Fast gzip size license Discord

Visit https://formik.org to get started with Formik.

Organizations and projects using Formik

List of organizations and projects using Formik

Authors

Contributing

This monorepo uses yarn, so to start you'll need the package manager installed.

To run E2E tests you'll also need Playwright set up, which can be done locally via npx playwright install. Afterward, run yarn start:app and in a separate tab run yarn e2e:ui to boot up the test runner.

When you're done with your changes, we use changesets to manage release notes. Run yarn changeset to autogenerate notes to be appended to your pull request.

Thank you!

Contributors

Formik is made with <3 thanks to these wonderful people (emoji key):


Jared Palmer

💬 💻 🎨 📖 💡 🤔 👀 ⚠️

Ian White

💬 🐛 💻 📖 🤔 👀

Andrej Badin

💬 🐛 📖

Adam Howard

💬 🐛 🤔 👀

Vlad Shcherbin

💬 🐛 🤔

Brikou CARRE

🐛 📖

Sam Kvale

🐛 💻 ⚠️

Jon Tansey

🐛 💻

Tyler Martinez

🐛 📖

Tobias Lohse

🐛 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Related

  • TSDX - Zero-config CLI for TypeScript used by this repo. (Formik's Rollup configuration as a CLI)

Apache 2.0 License.