ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: CLI ignores `rsc: false` setting and adds `"use client"` directive

Open gewoonseba opened this issue 2 weeks ago • 1 comments

Describe the bug

Summary

The shadcn add command adds the "use client" directive to components even when rsc: false is set in components.json. According to the documentation, when rsc is set to false, the CLI should NOT add the "use client" directive.

Configuration

{
  "$schema": "https://ui.shadcn.com/schema.json",
  "rsc": false,
  "style": "new-york-v4",
  "tsx": true
}

Expected Behavior

According to the documentation:

The CLI automatically adds a use client directive to client components when set to true.

Therefore, when rsc: false, the CLI should NOT add the "use client" directive.

Actual Behavior

The CLI adds "use client" at the top of installed components even when rsc: false is set.

Example installed file:

"use client"

import * as React from "react"
// ... rest of component

Workaround

Manually remove the "use client" directive from installed components after installation.

Affected component/components

Toggle Group

How to reproduce

  1. Set "rsc": false in components.json
  2. Run npx shadcn@latest add toggle-group (or any component)
  3. Check the installed component file

Codesandbox/StackBlitz link

No response

Logs


System Info

- **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

can i work on this issue ??

RAGHUKHAJURIA avatar Dec 09 '25 16:12 RAGHUKHAJURIA