@rjsf/utils vs react-jsonschema-form
Building JSON Schema-Based Forms in React
@rjsf/utilsreact-jsonschema-formSimilar Packages:
Building JSON Schema-Based Forms in React

@rjsf/utils and react-jsonschema-form are both part of the React JSON Schema Form (RJSF) ecosystem, which enables developers to generate UI forms from JSON Schema definitions. react-jsonschema-form is the core package that provides the <Form> component and full form rendering capabilities. @rjsf/utils is a supporting utility library containing helper functions used internally by RJSF and exposed for advanced customization. While react-jsonschema-form is a complete solution for rendering forms, @rjsf/utils alone cannot render a form—it only supplies utilities like schema resolution, validation logic helpers, and field manipulation functions.

Npm Package Weekly Downloads Trend
3 Years
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
@rjsf/utils618,66315,5002.25 MB19422 days agoApache-2.0
react-jsonschema-form52,61815,500-1946 years agoApache-2.0

@rjsf/utils vs react-jsonschema-form: Understanding Roles in the RJSF Ecosystem

At first glance, @rjsf/utils and react-jsonschema-form might seem like competing packages—but they serve fundamentally different purposes within the same ecosystem. Confusing them can lead to architectural missteps, like trying to render a form with only utilities or duplicating logic already provided by the core library. Let’s clarify their roles with real code and practical guidance.

🧱 Core Purpose: Renderer vs Helper Library

react-jsonschema-form is the main form-rendering engine. It exports the <Form> component that takes a JSON Schema and renders a fully interactive, validated form.

// react-jsonschema-form: Full form rendering
import Form from "react-jsonschema-form";

const schema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  }
};

function App() {
  return <Form schema={schema} onSubmit={({ formData }) => console.log(formData)} />;
}

@rjsf/utils is a collection of internal utilities. It does not export any React components and cannot render a form on its own. Instead, it provides functions like retrieveSchema, getDefaultFormState, or toIdSchema that power the internals of react-jsonschema-form.

// @rjsf/utils: Utility usage (typically inside custom fields or widgets)
import { retrieveSchema } from "@rjsf/utils";

const rootSchema = {
  type: "object",
  definitions: { person: { type: "object", properties: { name: { type: "string" } } } }
};

const uiSchema = {};
const formData = {};

// Resolve a subschema based on current data and UI schema
const resolved = retrieveSchema(rootSchema, uiSchema, formData);
console.log(resolved); // Returns the effective schema for rendering

⚠️ Critical Note: You cannot replace react-jsonschema-form with @rjsf/utils. The latter has no <Form> component and no rendering logic.

🔧 When You’d Use Each Package

Using react-jsonschema-form (The Default Choice)

You should start with react-jsonschema-form for any project that needs to generate forms from JSON Schema. It handles:

  • Rendering inputs based on schema types
  • Validation using Ajv
  • Conditional visibility (dependencies, oneOf, anyOf)
  • Array management (add/remove items)
  • Theming and custom widget/field registration
// Typical usage in an application
import Form from "react-jsonschema-form";
import { Theme as Bootstrap4Theme } from "@rjsf/bootstrap-4";

const schema = {
  title: "Todo",
  type: "object",
  required: ["title"],
  properties: {
    title: { type: "string", title: "Task" },
    done: { type: "boolean", title: "Completed?" }
  }
};

function TodoForm() {
  return (
    <Form
      schema={schema}
      validator={new CustomValidator()}
      onSubmit={({ formData }) => saveTodo(formData)}
      theme={Bootstrap4Theme}
    />
  );
}

Using @rjsf/utils (Advanced Customization Only)

You’ll reach for @rjsf/utils only when extending RJSF behavior, such as:

  • Building a custom field that needs to resolve nested schemas
  • Writing a custom validator that requires schema traversal
  • Precomputing form state before mounting the <Form>
// Example: Custom field using @rjsf/utils
import { retrieveSchema } from "@rjsf/utils";

function MyCustomField(props) {
  const { schema, uiSchema, formData, registry } = props;
  
  // Resolve the effective schema for this field's context
  const effectiveSchema = retrieveSchema(schema, uiSchema, formData);
  
  // Now render based on effectiveSchema...
  return <div>Custom logic using {effectiveSchema.title}</div>;
}

Without react-jsonschema-form, this utility is inert—it has no context, no form state manager, and no DOM output.

🧩 Dependency Relationship

In practice, @rjsf/utils is a peer dependency of react-jsonschema-form. When you install react-jsonschema-form, you typically get @rjsf/utils automatically (or are prompted to install it). The core form component relies on these utilities internally.

This means:

  • Never install @rjsf/utils alone for form rendering.
  • Always install react-jsonschema-form as your primary dependency.
  • Use @rjsf/utils imports only inside custom logic that augments the main <Form>.

🛠️ Real-World Integration Pattern

Most production apps follow this structure:

  1. Install react-jsonschema-form (and optionally a theme like @rjsf/bootstrap-4)
  2. Use the <Form> component directly with your schema
  3. Only import from @rjsf/utils when writing custom fields, widgets, or validators
// Correct architecture
import Form from "react-jsonschema-form";           // ✅ Main renderer
import { CustomWidget } from "./CustomWidget";     // Your custom code
import { retrieveSchema } from "@rjsf/utils";       // ✅ Only in custom logic

// In CustomWidget.jsx
export function CustomWidget(props) {
  // Use utils here if needed
  const effective = retrieveSchema(props.schema, props.uiSchema, props.formData);
  return <input value={effective.default} />;
}

Attempting to build a form without react-jsonschema-form would require reimplementing the entire form state machine, validation pipeline, and rendering layer—which defeats the purpose of using the ecosystem.

📌 Summary: Key Differences

Aspectreact-jsonschema-form@rjsf/utils
Primary RoleFull form rendererInternal utility functions
Exports React Component?✅ Yes (<Form>)❌ No
Can Render a Form Alone?✅ Yes❌ No — requires core renderer
Typical Importimport Form from "react-jsonschema-form"import { fn } from "@rjsf/utils"
Use CaseBuilding JSON Schema formsExtending/customizing RJSF behavior

💡 Final Recommendation

  • For 95% of developers: Install and use react-jsonschema-form. Ignore @rjsf/utils unless you hit a customization wall.
  • For advanced integrators: Use @rjsf/utils strictly within custom fields, widgets, or validators that plug into the main <Form> from react-jsonschema-form.

Think of it like this: react-jsonschema-form is the car; @rjsf/utils is the set of wrenches you use only when modifying the engine. You don’t drive the wrenches—you drive the car.

Using the right package for the right job keeps your code maintainable, avoids reinventing the wheel, and aligns with how the RJSF team designed the ecosystem.

How to Choose: @rjsf/utils vs react-jsonschema-form
  • @rjsf/utils:

    Choose @rjsf/utils only if you're already using react-jsonschema-form and need low-level utilities for customizing form behavior—such as resolving subschemas, validating specific fields, or manipulating form data programmatically. It is not a standalone form renderer and should never be used alone to build forms. This package is intended for advanced use cases where you’re extending or deeply integrating with the RJSF core.

  • react-jsonschema-form:

    Choose react-jsonschema-form when you need a complete, production-ready solution to render dynamic forms from JSON Schema and UI Schema definitions. It includes built-in support for validation, conditional fields, array handling, and theming. This is the primary package for implementing JSON Schema-driven forms in React applications and is actively maintained as the main entry point to the RJSF ecosystem.

README for @rjsf/utils

Build Status npm npm downloads Contributors Apache 2.0 License


Logo

@rjsf/utils

Utility functions for react-jsonschema-form.
Explore the docs »

View Playground · Report Bug · Request Feature

Table of Contents

About The Project

Exports utils functions for react-jsonschema-form.

Built With

Getting Started

Installation

yarn add @rjsf/utils

Usage

import * as Utils from '@rjsf/utils';

Documentation

Utility function documentation

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Read our contributors' guide to get started.

Contact

rjsf team: https://github.com/orgs/rjsf-team/people

GitHub repository: https://github.com/rjsf-team/react-jsonschema-form