packages/shadcn/README.md
<a href="https://rjsf-team.github.io/react-jsonschema-form/docs/"><strong>Explore the docs »</strong></a>
<a href="https://rjsf-team.github.io/react-jsonschema-form/">View Playground</a> · <a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Report Bug</a> · <a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Request Feature</a>
</p> <!-- TABLE OF CONTENTS -->Exports shadcn theme, fields and widgets for react-jsonschema-form.
@rjsf/core >= 6@rjsf/utils >= 6@rjsf/validator-ajv8 >= 6yarn add @rjsf/core @rjsf/utils @rjsf/validator-ajv8
yarn add @rjsf/shadcn
import Form from '@rjsf/shadcn';
or
import {withTheme} from '@rjsf/core';
import {Theme as shadcnTheme} from '@rjsf/shadcn';
const Form = withTheme(shadcnTheme);
Follow shadCN installation guide here for your application
The color of the RJSF will automatically apply with your shadCN config.
Add the following line to your tailwind.config.ts
content: [
"./src/**/*.{html,js}",
"node_modules/@rjsf/shadcn/src/**/*.{js,ts,jsx,tsx,mdx}" // Add this line
],
Add the following line to your equivalent global.css
@source "../node_modules/@rjsf/shadcn";
All shadcn's default color theme are included in the npm packages. Simply do
import '@rjsf/shadcn/dist/[color].css';
e.g:
import '@rjsf/shadcn/dist/zinc.css';
Supported colors are:
If you are not using tailwind but still wants to use this theme, you can follow these steps:
cd packages/shadcn
npm i
npm run build:css
Check out this section by shadCN
npm install @radix-ui/react-direction --save
Wrap your layout with DirectionProvider:
import {DirectionProvider as RadixDirectionProvider} from '@radix-ui/react-direction;
function Layout({children, direction}) {
return (
<RadixDirectionProvider dir={direction}>
{children}
</RadixDirectionProvider>
);
}
Set HTML direction attribute:
<html dir="rtl" lang="en">
You can refer to direction-context.tsx, direction-provider.tsx and rtl-toggle.tsx from demo repository for
implementation.
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
<!-- MARKDOWN LINKS & IMAGES --> <!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->