### Local Development Setup
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/daisyui/README.md
Instructions for setting up the development environment, including cloning the repository, installing dependencies, building packages, and running the playground.
```bash
# Clone the repository
git clone https://github.com/rjsf-team/react-jsonschema-form.git
cd react-jsonschema-form
# Install dependencies
npm install
# Build packages
npm run build
# Run playground
npm run start:playground
```
--------------------------------
### Install and Build Project
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/contributing.md
Run these commands from the root directory to install dependencies, build the project, and start the local development server for the playground.
```bash
npm install
npm run build
cd packages/playground
npm start
```
--------------------------------
### Start Playground
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/CLAUDE.md
Starts the Vite development server for the playground application.
```bash
cd packages/playground && npm start
```
--------------------------------
### Install Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/CLAUDE.md
Installs all project dependencies using npm.
```bash
npm install
```
--------------------------------
### Install Core RJSF Packages
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/shadcn/README.md
Install the necessary core packages for react-jsonschema-form before installing the shadcn theme.
```bash
yarn add @rjsf/core @rjsf/utils @rjsf/validator-ajv8
```
--------------------------------
### Install Project Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/README.md
Run this command in your terminal to install all necessary project dependencies.
```bash
$ npm install
```
--------------------------------
### Install @rjsf/core
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/core/README.md
Install the core package using npm.
```sh
npm install @rjsf/core
```
--------------------------------
### Install Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/00-introduction.mdx
Install the core package, utilities, and a validator implementation like @rjsf/validator-ajv8 using npm.
```bash
$ npm install @rjsf/core @rjsf/utils @rjsf/validator-ajv8 --save
```
--------------------------------
### Start Local Development Server
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/README.md
Starts a local development server and opens the project in your browser. Changes are reflected live without server restarts.
```bash
$ npm start
```
--------------------------------
### Install Radix UI Direction Provider
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/shadcn/README.md
Install the Radix UI Direction Provider package for RTL support.
```bash
npm install @radix-ui/react-direction --save
```
--------------------------------
### Install ATA Validator
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/validator-ata/README.md
Install the ATA validator package and its peer dependency. Ensure both are installed together.
```bash
npm install @rjsf/validator-ata ata-validator
```
--------------------------------
### Install @rjsf/chakra-ui Package
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/chakra-ui/README.md
Install the @rjsf/chakra-ui package itself after adding its peer dependencies.
```bash
yarn add @rjsf/chakra-ui
```
--------------------------------
### Install @rjsf/daisyui and Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/daisyui/README.md
Install the DaisyUI theme for RJSF along with core RJSF packages and Tailwind CSS.
```bash
npm install @rjsf/daisyui @rjsf/core @rjsf/utils @rjsf/validator-ajv8 tailwindcss daisyui
```
--------------------------------
### Install React JsonSchema Form Utils
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/validator-ajv8/README.md
Before installing the validator, ensure you have the core react-jsonschema-form utilities installed. This command adds the necessary core package.
```bash
yarn add @rjsf/core
```
--------------------------------
### Install Semantic UI Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/semantic-ui/README.md
Install the necessary Semantic UI and react-jsonschema-form core packages. Ensure you have semantic-ui-css and semantic-ui-react installed.
```sh
yarn add semantic-ui-css semantic-ui-react @rjsf/core
```
--------------------------------
### Install Core Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/primereact/README.md
Installs the necessary core packages for react-jsonschema-form and PrimeReact.
```sh
npm install primereact primeicons @rjsf/core
```
--------------------------------
### Run Documentation Locally
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/contributing.md
Navigate to the docs directory and run this command to start the local documentation development server.
```bash
cd packages/docs
npm start
```
--------------------------------
### Install Dependencies for Fluent UI RC
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/fluentui-rc/README.md
Install the necessary Fluent UI and react-jsonschema-form packages. Ensure versions are compatible.
```bash
yarn add @fluentui/react-components @fluentui/react-icons @fluentui/react-migration-v0-v9 @rjsf/core @rjsf/utils @rjsf/validator-ajv8
```
--------------------------------
### Install @rjsf/snapshot-tests
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/snapshot-tests/README.md
Install the package using npm. This command adds the snapshot testing utilities to your project dependencies.
```sh
npm install @rjsf/snapshot-tests
```
--------------------------------
### Install Shadcn Theme Package
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/shadcn/README.md
Install the shadcn theme package for react-jsonschema-form.
```bash
yarn add @rjsf/shadcn
```
--------------------------------
### Setup Git Hooks
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/contributing.md
Run this script for the first time to set up husky for git precommit hooks, which format and lint code before committing.
```bash
npm run prepare
```
--------------------------------
### Install @rjsf/utils with Yarn
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/utils/README.md
Install the @rjsf/utils package using Yarn. This is the primary method for adding the utility functions to your project.
```bash
yarn add @rjsf/utils
```
--------------------------------
### Build Custom CSS File
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/shadcn/README.md
Clone the repository, install dependencies, and build the CSS if you need to customize the theme or are not using Tailwind.
```bash
cd packages/shadcn
npm i
npm run build:css
```
--------------------------------
### Install Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/antd/README.md
Install the necessary peer dependencies for @rjsf/antd. Ensure versions are compatible.
```sh
npm install antd @ant-design/icons dayjs @rjsf/core @rjsf/utils @rjsf/validator-ajv8
```
--------------------------------
### Install Fluent UI RC Theme
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/fluentui-rc/README.md
Add the @rjsf/fluentui-rc package to your project to use the Fluent UI theme.
```bash
yarn add @rjsf/fluentui-rc
```
--------------------------------
### Static uiSchema Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/api-reference/dynamic-ui-schema-examples.md
Demonstrates a traditional static uiSchema that requires no changes for backward compatibility.
```typescript
import { UiSchema } from '@rjsf/utils';
// This continues to work exactly as before
const uiSchema: UiSchema = {
guests: {
items: {
name: { 'ui:placeholder': 'Enter guest name' },
age: { 'ui:widget': 'updown' },
relationship: { 'ui:widget': 'select' },
},
},
};
```
--------------------------------
### Install @rjsf/chakra-ui Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/chakra-ui/README.md
Install the necessary dependencies for @rjsf/chakra-ui, including Chakra UI components, react-select, and core react-jsonschema-form packages.
```bash
yarn add @chakra-ui/react chakra-react-select @rjsf/core @rjsf/utils @rjsf/validator-ajv8
```
--------------------------------
### examplesId
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/api-reference/utility-functions.md
Return a consistent `id` for the field examples element.
```APIDOC
## examplesId()
### Description
Return a consistent `id` for the field examples element.
### Parameters
- id: FieldPathId | string - Either simple string id or an FieldPathId from which to extract it
### Returns
- string: The consistent id for the field examples element from the given `id`
```
--------------------------------
### Install PrimeReact Theme Package
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/primereact/README.md
Installs the specific PrimeReact theme package for react-jsonschema-form.
```sh
npm install @rjsf/primereact
```
--------------------------------
### Install RJSF Mantine Theme
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/mantine/README.md
Install the RJSF Mantine theme package.
```sh
npm install @rjsf/mantine
```
--------------------------------
### Install @rjsf/antd Package
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/antd/README.md
Install the @rjsf/antd package to use the Ant Design theme with react-jsonschema-form.
```sh
npm install @rjsf/antd
```
--------------------------------
### Custom GridTemplate Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/advanced-customization/custom-templates.md
Customize how grids are rendered by providing a custom `GridTemplate`. This example shows how to extend `Grid2` from `@mui/material` and apply custom styling.
```tsx
import { Grid2 } from '@mui/material';
import { GridTemplateProps } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv8';
import classNames from 'classnames';
const schema: RJSFSchema = {
type: 'string',
title: 'My input',
description: 'input description',
};
function GridTemplate(props: FieldHelpProps) {
const { children, column, className, ...rest } = props;
return (
{children}
);
}
render(
, document.getElementById('app'));
```
--------------------------------
### Install @rjsf/mui Package
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/mui/README.md
Add the @rjsf/mui package to your project to enable Material UI integration.
```bash
yarn add @rjsf/mui
```
--------------------------------
### Complex Layout Grid Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/usage/layout-grid.md
Demonstrates a complex layout using nested ui:row and ui:col to structure form fields. This example shows how to control column widths, hide labels, and apply styles for fine-tuned widget presentation.
```json
{
"ui:field": "LayoutGridField",
"ui:layoutGrid": {
"ui:row": {
"className": "row",
"children": [
{
"ui:row": [
{
"ui:col": {
"className": "col-xs-12",
"children": ["person"]
}
}
]
},
{
"ui:row": [
{
"ui:col": {
"className": "col-xs-5",
"children": ["person.first"]
}
},
{
"ui:col": {
"className": "col-xs-2",
"style": {
"margin-top": "25px"
},
"children": [
{
"name": "person.middle",
"label": false
}
]
}
},
{
"ui:col": {
"className": "col-xs-5",
"children": ["person.last"]
}
}
]
}
]
}
},
"person": {
"ui:field": "LayoutHeaderField"
}
}
```
--------------------------------
### anyOf Schema Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/json-schema/oneof.md
Use 'anyOf' when at least one of the subschemas must be valid. This example allows for a 'lorem' string alone, or both 'lorem' and 'ipsum' strings.
```tsx
import { RJSFSchema } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv8';
const schema: RJSFSchema = {
type: 'object',
anyOf: [
{
properties: {
lorem: {
type: 'string',
},
},
required: ['lorem'],
},
{
properties: {
lorem: {
type: 'string',
},
ipsum: {
type: 'string',
},
},
},
],
};
render(, document.getElementById('app'));
```
--------------------------------
### UI Schema Deprecation Example (classNames)
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/migration-guides/v5.x upgrade guide.md
Shows how to correctly use 'ui:classNames' to avoid deprecation warnings. The first example logs a warning, while the second demonstrates the correct usage.
```tsx
import { UiSchema } from '@rjsf/utils';
// This uiSchema will log a deprecation warning to the console
const uiSchemaLog: UiSchema = {
title: {
classNames: 'myClass',
},
};
// This uiSchema will not
const uiSchemaNoLog: UiSchema = {
title: {
'ui:classNames': 'myClass',
},
};
```
--------------------------------
### Form acceptCharset Prop Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/migration-guides/v6.x upgrade guide.md
Use the `acceptCharset` prop instead of `acceptcharset` on the Form component.
```tsx
```
--------------------------------
### Custom BaseInputTemplate Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/advanced-customization/custom-templates.md
Integrate a custom text input component by overriding the BaseInputTemplate. This example shows how to use `getInputProps` and handle input changes and blur events.
```tsx
import { ChangeEvent, FocusEvent } from 'react';
import { getInputProps, RJSFSchema, BaseInputTemplateProps } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv8';
import CustomTextInput from '../CustomTextInput';
const schema: RJSFSchema = {
type: 'string',
title: 'My input',
description: 'input description',
};
function BaseInputTemplate(props: BaseInputTemplateProps) {
const {
schema,
id,
options,
label,
value,
type,
placeholder,
required,
disabled,
readonly,
autofocus,
onChange,
onChangeOverride,
onBlur,
onFocus,
rawErrors,
hideError,
uiSchema,
registry,
...rest
} = props;
const onTextChange = ({ target: { value: val } }: ChangeEvent) => {
// Use the options.emptyValue if it is specified and newVal is also an empty string
onChange(val === '' ? options.emptyValue || '' : val);
};
const onTextBlur = ({ target: { value: val } }: FocusEvent) => onBlur(id, val);
const onTextFocus = ({ target: { value: val } }: FocusEvent) => onFocus(id, val);
const inputProps = { ...rest, ...getInputProps(schema, type, options) };
const hasError = rawErrors.length > 0 && !hideError;
return (
);
}
render(
,
document.getElementById('app'),
);
```
--------------------------------
### Install Semantic UI Theme Package
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/semantic-ui/README.md
Add the Semantic UI theme package for react-jsonschema-form to your project.
```sh
yarn add @rjsf/semantic-ui
```
--------------------------------
### Install RJSF Mantine Dependencies
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/mantine/README.md
Install the necessary Mantine and RJSF core packages before installing the Mantine theme.
```sh
npm install @mantine/core @mantine/hooks @mantine/dates dayjs @rjsf/core
```
--------------------------------
### Install Dependencies for react-bootstrap
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/react-bootstrap/README.md
Install the necessary dependencies for using the react-bootstrap theme with react-jsonschema-form. Ensure you have react-bootstrap, @rjsf/core, @rjsf/utils, and @rjsf/validator-ajv8 installed.
```bash
yarn add react-bootstrap @rjsf/core @rjsf/utils @rjsf/validator-ajv8
```
--------------------------------
### Basic Usage of withTheme HOC
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/advanced-customization/custom-themes.md
Demonstrates how to import `withTheme`, define a simple theme object with custom widgets, and create a themed-component to be used in your application.
```tsx
import React, { Component } from 'react';
import validator from '@rjsf/validator-ajv8';
import { withTheme, ThemeProps } from '@rjsf/core';
const theme: ThemeProps = { widgets: { test: () =>
test
} };
const ThemedForm = withTheme(theme);
const Demo = () => ;
```
--------------------------------
### Build All Packages (Sequential)
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/CLAUDE.md
Builds all packages sequentially, useful if parallel builds cause issues.
```bash
npm run build-serial
```
--------------------------------
### Build Project for Production
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/README.md
Generates static content for deployment. The output is placed in the 'build' directory.
```bash
$ npm build
```
--------------------------------
### Equivalent uiSchema Syntaxes
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/api-reference/uiSchema.md
Demonstrates two equivalent ways to define uiSchema properties for rendering control. Use either the `ui:property` or `ui:options` syntax for properties like title, description, and classNames.
```json
{
"ui:title": "Title",
"ui:description": "Description",
"ui:classNames": "my-class",
"ui:submitButtonOptions": {
"props": {
"disabled": false,
"className": "btn btn-info"
},
"norender": false,
"submitText": "Submit"
}
}
```
```json
{
"ui:options": {
"title": "Title",
"description": "Description",
"classNames": "my-class",
"submitButtonOptions": {
"props": {
"disabled": false,
"className": "btn btn-info"
},
"norender": false,
"submitText": "Submit"
}
}
}
```
--------------------------------
### Snapshot Testing Setup for Themes
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/contributing.md
Demonstrates how themes integrate with the core snapshot testing utilities. Each theme imports specific test functions and passes its Form component for testing.
```tsx
import { arrayTests } from '@rjsf/snapshot-tests'; // OR
// import { formTests } from '@rjsf/snapshot-tests';
// import { objectTests } from '@rjsf/snapshot-tests';
import Form from '../src';
arrayTests(Form); // OR
// formTests(Form);
// objectTests(Form);
```
--------------------------------
### Install react-bootstrap Theme
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/react-bootstrap/README.md
Install the @rjsf/react-bootstrap package to integrate the Bootstrap 5 theme into your react-jsonschema-form application.
```bash
yarn add @rjsf/react-bootstrap
```
--------------------------------
### Format Code
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/contributing.md
Run this command within any package directory to format the code according to the project's coding style.
```bash
npm cs-format
```
--------------------------------
### Run Single Package Tests
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/CLAUDE.md
Navigates to the 'core' package and runs its tests.
```bash
cd packages/core && npm test
```
--------------------------------
### Install AJV8 Validator Package
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/validator-ajv8/README.md
Install the AJV-8 based validator package for react-jsonschema-form. This command adds the validator plugin to your project.
```bash
yarn add @rjsf/validator-ajv8
```
--------------------------------
### Import and Apply Fluent UI RC Theme with Customizations
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/fluentui-rc/README.md
Import the theme and use `withTheme` from @rjsf/core to apply it. This allows for modifications to the theme with custom fields and widgets.
```javascript
import { withTheme } from '@rjsf/core';
import { Theme as FluentUIRCTheme } from '@rjsf/fluentui-rc';
// Make modifications to the theme with your own fields and widgets
const Form = withTheme(FluentUIRCTheme);
```
--------------------------------
### Install Dependencies for MUI v7
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/mui/README.md
Install the necessary Material UI and react-jsonschema-form dependencies before adding the @rjsf/mui package. Requires React 18.
```bash
yarn add @mui/material @mui/icons-material @emotion/react @emotion/styled @rjsf/core @rjsf/utils @rjsf/validator-ajv8
```
--------------------------------
### Custom UnsupportedFieldTemplate Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/advanced-customization/custom-templates.md
Create a custom `UnsupportedFieldTemplate` to handle and display fields with unsupported schema types. This example uses `react-intl` for localization.
```tsx
import { RJSFSchema, UnsupportedFieldProps } from '@rjsf/utils';
import { FormattedMessage } from 'react-intl';
import validator from '@rjsf/validator-ajv8';
const schema: RJSFSchema = {
type: 'invalid',
};
function UnsupportedFieldTemplate(props: UnsupportedFieldProps) {
const { schema, reason } = props;
return (
{JSON.stringify(schema, null, 2)}
);
}
render(
,
document.getElementById('app'),
);
```
--------------------------------
### Troubleshoot Build Failures
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/contributing.md
These commands help restore a working development environment by refreshing node modules and cleaning build caches. Run them from the root directory.
```bash
npm run refresh-node-modules
npm run clean-build
```
--------------------------------
### Custom TitleFieldTemplate Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/advanced-customization/custom-templates.md
Implement a custom `TitleFieldTemplate` to control how field titles are rendered. This example shows how to display the title and a required marker.
```tsx
import { RJSFSchema, TitleFieldProps } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv8';
const schema: RJSFSchema = {
type: 'string',
title: 'My input',
description: 'input description',
};
function TitleFieldTemplate(props: TitleFieldProps) {
const { id, required, title } = props;
return (
{title}
{required && *}
);
}
render(
,
document.getElementById('app'),
);
```
--------------------------------
### Run All Tests
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/contributing.md
Execute all project tests from the root directory or the packages subdirectory.
```bash
npm run test
```
--------------------------------
### getFromSchema
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/api-reference/utility-functions.md
Helper that acts like lodash's `get` but additionally retrieves `$ref`s as needed to get the path for schemas containing potentially nested `$ref`s.
```APIDOC
## getFromSchema()
### Description
Helper that acts like lodash's `get` but additionally retrieves `$ref`s as needed to get the path for schemas containing potentially nested `$ref`s.
The `path` accepts a [`SchemaFieldPath`](#types) (dotted string or `FieldPathList`-style segment array).
### Parameters
- validator (ValidatorType): An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
- rootSchema (S): The root schema that will be forwarded to all the APIs
- schema (S): The current node within the JSON schema recursion
- path (SchemaFieldPath): Dotted path or segment list to the desired field; see [`SchemaFieldPath`](#types)
- defaultValue (T | S): The value to return if a value is not found for the `pathList` path
- experimental_customMergeAllOf (Experimental_CustomMergeAllOf): See `Form` documentation for the [experimental_customMergeAllOf](./form-props.md#experimental_custommergeallof) prop
### Returns
- T | S: The inner schema from the `schema` for the given `path` or the `defaultValue` if not found
```
--------------------------------
### Import Shadcn Theme with withTheme
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/shadcn/README.md
Alternatively, import the shadcn theme and use it with the withTheme higher-order component from @rjsf/core.
```javascript
import {withTheme} from '@rjsf/core';
import {Theme as shadcnTheme} from '@rjsf/shadcn';
const Form = withTheme(shadcnTheme);
```
--------------------------------
### Custom FieldTemplate Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/advanced-customization/custom-templates.md
Create a custom `FieldTemplate` to restructure the layout of each form field row. This example includes the label, description, children (widget), errors, and help.
```tsx
import { FieldTemplateProps, RJSFSchema } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv8';
const schema: RJSFSchema = {
type: 'string',
};
function CustomFieldTemplate(props: FieldTemplateProps) {
const { id, classNames, style, label, help, required, description, errors, children } = props;
return (
{description}
{children}
{errors}
{help}
);
}
render(
,
document.getElementById('app'),
);
```
--------------------------------
### Run All Tests
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/daisyui/TEST_PLAN.md
Execute all defined tests within the project. Use this for general testing or before committing changes.
```bash
npm test
```
--------------------------------
### Enable File Widget Preview
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/api-reference/uiSchema.md
Configure the FileWidget to show a preview for images or a download link for non-images using the 'filePreview' flag within 'ui:options'.
```tsx
import { RJSFSchema, UiSchema } from '@rjsf/utils';
const schema: RJSFSchema = {
type: 'string',
format: 'data-url',
};
const uiSchema: UiSchema = {
'ui:options': {
filePreview: true,
},
};
```
--------------------------------
### Custom FieldHelpTemplate Example
Source: https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/docs/docs/advanced-customization/custom-templates.md
Define a custom `FieldHelpTemplate` to control how help text for a field is rendered. This example wraps the help text in an `