React Hook Form integration with shadcn/ui components.
react-hook-form-shadcn provides React Hook Form adapters for apps built with shadcn/ui, similar to how react-hook-form-mui integrates with Material UI.
Unlike MUI, shadcn/ui is not a package, but a set of local components. Therefore, this package must remain UI-agnostic and rely on a registry provider where consumers inject their own components.
| Aspect | MUI Version | Shadcn Version |
|---|---|---|
| UI Library | External dependency (@mui/material) |
Local components copied into the app |
| Integration | Imports MUI components directly | Uses a registry provider to access user-provided components |
| Customization | Limited to MUI theme system | Fully customizable (user defines Tailwind/shadcn variants) |
- Node.js 20+
- Yarn 4.10+
yarn installyarn dev- Start TypeScript compiler in watch modeyarn type-check- Run TypeScript type checking
yarn build- Build the package for ES modules with Rollup- Output:
dist/index.jsanddist/index.d.ts
yarn test- Run all tests with Jest
yarn lint- Run ESLint to check code qualityyarn lint:fix- Run ESLint and auto-fix issuesyarn format- Format code with Prettier
The package is configured to publish ES modules to npm. Before publishing:
- Update version in
package.json - Run
yarn buildto generatedist/files - Ensure all tests pass:
yarn test - Ensure code quality:
yarn lint
Only the files specified in package.json's files field will be included in the npm package.
- Create a feature branch
- Make your changes
- Run
yarn lint:fixto format your code - Run
yarn testto ensure tests pass - Submit a pull request
MIT