Skip to content

[bug]: fix(cli): migrate radix outputs SlotPrimitive.Slot instead of Slot.Root #11564

Description

@Abhirup0

Describe the bug

Description

When running shadcn migrate radix, components using @radix-ui/react-slot are converted to import { Slot as SlotPrimitive } from "radix-ui" and const Comp = asChild ? SlotPrimitive.Slot : "button".

In shadcn v4, components standardize on import { Slot } from "radix-ui" and Slot.Root. Using SlotPrimitive.Slot causes inconsistency across registry components and breaks prop typing.

Suggested Fix

In packages/shadcn/src/migrations/migrate-radix.ts:

  1. Do not alias Slot as SlotPrimitive when extracting imports.
  2. Replace __SLOT_PLACEHOLDER__ with Slot.Root.

Affected component/components

Affected Files packages/shadcn/src/migrations/migrate-radix.ts: - Lines 47–52 & 85–90: Aliases Slot to SlotPrimitive - Line 440: Replaces Slot with SlotPrimitive.Slot

How to reproduce

Steps to Reproduce

  1. In a project with a component using import { Slot } from "@radix-ui/react-slot".
  2. Run npx shadcn@latest migrate radix.
  3. Check the transformed file: it generates SlotPrimitive.Slot.

Codesandbox/StackBlitz link

No response

Logs

System Info

- OS: Windows 11 (all OS affected)
- Node: >= 20.x
- Package: shadcn CLI (@latest / 4.18.0)

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions