ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: CLI only install React 19 version of components when setting `style` in `components.json` to `new-york-v4`

Open gewoonseba opened this issue 2 weeks ago • 0 comments

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-yorknew-york-v4 (same as view does).

Actual Behavior

  • view command: Correctly detects React 19 and resolves to registry/new-york-v4/ui/toggle-group.tsx
  • add command: Uses the literal style value from components.json (new-york) and resolves to registry/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 canary version exhibits the same behavior

Affected component/components

Toggle Group

How to reproduce

Steps to Reproduce

  1. Set up a project with React 19 ([email protected], [email protected]) and Tailwind CSS v4 ([email protected])
  2. Configure components.json with "style": "new-york"
  3. Run npx shadcn@latest view toggle-group → Shows React 19 component from registry/new-york-v4/ui/toggle-group.tsx (no forwardRef)
  4. Run npx shadcn@latest add toggle-group → Installs React 18 component from registry/new-york/ui/toggle-group.tsx (uses forwardRef)

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

gewoonseba avatar Dec 08 '25 20:12 gewoonseba