A beautiful Tailwind CSS theme for React JSON Schema Form.
npm install @pankajpatel/rjsf-tailwind
# or
yarn add @pankajpatel/rjsf-tailwindimport { RJSFTailwindTheme } from "@pankajpatel/rjsf-tailwind";
import Form from "@rjsf/core";
import validator from "@rjsf/validator-ajv8";
const schema = {
title: "Todo",
type: "object",
required: ["title"],
properties: {
title: { type: "string", title: "Title", default: "A new task" },
done: { type: "boolean", title: "Done?", default: false }
}
};
function App() {
return (
<Form
schema={schema}
validator={validator}
theme={RJSFTailwindTheme}
onSubmit={console.log}
/>
);
}- 🎨 Beautiful Tailwind CSS styling
- 🌙 Dark mode support
- 🎯 Fully customizable with Tailwind classes
- ♿️ Accessible components
- 📱 Responsive design
- 🔧 Easy to extend and customize
Visit our live demo site at https://pankajpatel.github.io/rjsf-tailwind to see the theme in action.
The demo is automatically deployed when:
- A new release is published
- Manual deployment is triggered via GitHub Actions
To run the demo locally:
yarn install
yarn devYou can customize the theme by extending Tailwind's configuration:
// tailwind.config.js
module.exports = {
content: [
'./src/**/*.{js,jsx,ts,tsx}',
'./node_modules/@pankajpatel/rjsf-tailwind/dist/**/*.{js,jsx,ts,tsx}'
],
theme: {
extend: {
// Your custom theme configuration
}
}
}You can customize individual form components using the uiSchema prop:
const uiSchema = {
"ui:classNames": "custom-class",
title: {
"ui:widget": "textarea"
}
};
<Form
schema={schema}
uiSchema={uiSchema}
validator={validator}
theme={RJSFTailwindTheme}
/>- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes following the Conventional Commits specification:
feat: add new feature- for new featuresfix: resolve bug- for bug fixesdocs: update readme- for documentationchore: update deps- for dependency updatesstyle: format code- for styling changesrefactor: improve code- for code improvementstest: add tests- for testingperf: improve performance- for performance improvements
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This package follows Semantic Versioning. To publish a new version:
-
Create a new release on GitHub:
- Go to the repository's Releases page
- Click "Create a new release"
- Create a new tag in the format
x.y.z(e.g.,1.0.0) - Add release notes describing the changes
- Publish the release
-
The GitHub Action will automatically:
- Build the package
- Publish to NPM
- Deploy the demo site
To create a release:
- Major version (x.0.0): Breaking changes
- Minor version (0.x.0): New features
- Patch version (0.0.x): Bug fixes and patches
ISC
To start development:
# Install dependencies
yarn install
# Start development
yarn dev
# Build
yarn build