@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.
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.
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-formwith@rjsf/utils. The latter has no<Form>component and no rendering logic.
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:
dependencies, oneOf, anyOf)// 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}
/>
);
}
@rjsf/utils (Advanced Customization Only)You’ll reach for @rjsf/utils only when extending RJSF behavior, such as:
<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.
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:
@rjsf/utils alone for form rendering.react-jsonschema-form as your primary dependency.@rjsf/utils imports only inside custom logic that augments the main <Form>.Most production apps follow this structure:
react-jsonschema-form (and optionally a theme like @rjsf/bootstrap-4)<Form> component directly with your schema@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.
| Aspect | react-jsonschema-form | @rjsf/utils |
|---|---|---|
| Primary Role | Full form renderer | Internal utility functions |
| Exports React Component? | ✅ Yes (<Form>) | ❌ No |
| Can Render a Form Alone? | ✅ Yes | ❌ No — requires core renderer |
| Typical Import | import Form from "react-jsonschema-form" | import { fn } from "@rjsf/utils" |
| Use Case | Building JSON Schema forms | Extending/customizing RJSF behavior |
react-jsonschema-form. Ignore @rjsf/utils unless you hit a customization wall.@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.
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.
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.
Utility functions for react-jsonschema-form.
Explore the docs »
View Playground
·
Report Bug
·
Request Feature
Exports utils functions for react-jsonschema-form.
yarn add @rjsf/utils
import * as Utils from '@rjsf/utils';
Utility function documentation
See the open issues for a list of proposed features (and known issues).
Read our contributors' guide to get started.
rjsf team: https://github.com/orgs/rjsf-team/people
GitHub repository: https://github.com/rjsf-team/react-jsonschema-form