ui
ui copied to clipboard
[bug]: CLI only install React 19 version of components when setting `style` in `components.json` to `new-york-v4`
Describe the bug
Summary
The shadcn add command installs React 18 components (using forwardRef) even when the project uses React 19, while the shadcn view command correctly shows React 19 components (without forwardRef). This indicates inconsistent registry path resolution between the two commands.
Expected Behavior
Both view and add commands should resolve to the same registry path. The add command should detect React 19 and automatically upgrade new-york → new-york-v4 (same as view does).
Actual Behavior
viewcommand: Correctly detects React 19 and resolves toregistry/new-york-v4/ui/toggle-group.tsxaddcommand: Uses the literal style value fromcomponents.json(new-york) and resolves toregistry/new-york/ui/toggle-group.tsx, installing React 18 components
Workaround
Set "style": "new-york-v4" in components.json to force React 19 components.
Additional Notes
- The
canaryversion exhibits the same behavior
Affected component/components
Toggle Group
How to reproduce
Steps to Reproduce
- Set up a project with React 19 (
[email protected],[email protected]) and Tailwind CSS v4 ([email protected]) - Configure
components.jsonwith"style": "new-york" - Run
npx shadcn@latest view toggle-group→ Shows React 19 component fromregistry/new-york-v4/ui/toggle-group.tsx(noforwardRef) - Run
npx shadcn@latest add toggle-group→ Installs React 18 component fromregistry/new-york/ui/toggle-group.tsx(usesforwardRef)
Codesandbox/StackBlitz link
No response
Logs
System Info
## Environment
- **CLI Version**: `shadcn@latest` (3.5.1)
- **React Version**: 19.1.0
- **React DOM Version**: 19.1.0
- **Tailwind CSS Version**: 4.0.6 (with `@tailwindcss/[email protected]` and `@tailwindcss/[email protected]`)
- **Package Manager**: npm
- **Project Type**: Monorepo
Before submitting
- [x] I've made research efforts and searched the documentation
- [x] I've searched for existing issues