@jsonforms/react vs formik vs react-final-form vs react-hook-form vs react-jsonschema-form vs uniforms
React Form Libraries
@jsonforms/reactformikreact-final-formreact-hook-formreact-jsonschema-formuniformsSimilar 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
@jsonforms/react02,737285 kB1503 months agoMIT
formik034,327585 kB84010 months agoApache-2.0
react-final-form07,439263 kB3784 months agoMIT
react-hook-form044,8481.22 MB107 days agoMIT
react-jsonschema-form015,889-1487 years agoApache-2.0
uniforms02,103224 kB302 years agoMIT

Feature Comparison: @jsonforms/react vs formik vs react-final-form vs react-hook-form vs react-jsonschema-form vs uniforms

Schema Support

  • @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.

  • 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.

  • 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.

  • 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.

Validation

  • @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.

  • 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.

  • 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.

  • 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.

Customization

  • @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.

  • 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.

  • 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.

  • 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.

Performance

  • @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.

  • 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.

  • 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.

  • 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.

Ease of Use: Code Examples

  • @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;
    
  • 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;
    
  • 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;
    
  • 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;
    

How to Choose: @jsonforms/react vs formik vs react-final-form vs react-hook-form vs react-jsonschema-form vs uniforms

  • @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.

  • 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.

  • 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.

  • 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.

README for @jsonforms/react

JSON Forms - More Forms. Less Code

Complex forms in the blink of an eye

JSON Forms eliminates the tedious task of writing fully-featured forms by hand by leveraging the capabilities of JSON, JSON Schema and Javascript.

React Package

This is the JSON Forms React package which provides the necessary bindings for React. It uses JSON Forms Core.

You can combine the react package with any react-based renderer set you want, for example the Material Renderers or the Vanilla Renderers.

See the official documentation and the JSON Forms React seed repository for examples on how to integrate JSON Forms with your application.

Check https://www.npmjs.com/search?q=%40jsonforms for all published JSON Forms packages.

Usage

Use the JsonForms component to render a form for your data.

Mandatory props:

  • data: any - the data to show
  • renderers: JsonFormsRendererRegistryEntry[] - the React renderer set to use

Optional props:

  • schema: JsonSchema - the data schema for the given data. Will be generated when not given.
  • uischema: UISchemaElement - the UI schema for the given data schema. Will be generated when not given.
  • cells: JsonFormsCellRendererRegistryEntry[] - the React cell renderer set to use
  • config: any - form-wide options. May contain default ui schema options.
  • readonly: boolean - whether all controls shall be readonly.
  • uischemas: JsonFormsUiSchemaEntry[] - registry for dynamic ui schema dispatching
  • validationMode: 'ValidateAndShow' | 'ValidateAndHide' | 'NoValidation' - the validation mode for the form
  • ajv: AJV - custom Ajv instance for the form
  • middleware: Middleware - can be used to hook into the form-wide data management.
  • i18n: JsonFormsI18nState - can be used to internationalize the rendered form.
  • onChange - callback which is called initially and on each data change, containing the updated data and the validation result.

Example:

import React, { useState } from 'react';
import {
  materialRenderers,
  materialCells,
} from '@jsonforms/material-renderers';
import { JsonForms } from '@jsonforms/react';

const schema = {
  type: 'object',
  properties: {
    name: {
      type: 'string',
      minLength: 1,
    },
    done: {
      type: 'boolean',
    },
    due_date: {
      type: 'string',
      format: 'date',
    },
    recurrence: {
      type: 'string',
      enum: ['Never', 'Daily', 'Weekly', 'Monthly'],
    },
  },
  required: ['name', 'due_date'],
};
const uischema = {
  type: 'VerticalLayout',
  elements: [
    {
      type: 'Control',
      label: false,
      scope: '#/properties/done',
    },
    {
      type: 'Control',
      scope: '#/properties/name',
    },
    {
      type: 'HorizontalLayout',
      elements: [
        {
          type: 'Control',
          scope: '#/properties/due_date',
        },
        {
          type: 'Control',
          scope: '#/properties/recurrence',
        },
      ],
    },
  ],
};
const initialData = {};
function App() {
  const [data, setData] = useState(initialData);
  return (
    <JsonForms
      schema={schema}
      uischema={uischema}
      data={data}
      renderers={materialRenderers}
      cells={materialCells}
      onChange={({ data, _errors }) => setData(data)}
    />
  );
}
export default App;

License

The JSON Forms project is licensed under the MIT License. See the LICENSE file for more information.

Roadmap

Our current roadmap is available here.

Feedback, Help and Support

JSON Forms is developed by EclipseSource.

If you encounter any problems feel free to open an issue on the repo. For questions and discussions please use the JSON Forms board. You can also reach us via email. In addition, EclipseSource also offers professional support for JSON Forms.

Migration

See our migration guide when updating JSON Forms.