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:
- Do not alias
Slot as SlotPrimitive when extracting imports.
- 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
- In a project with a component using
import { Slot } from "@radix-ui/react-slot".
- Run
npx shadcn@latest migrate radix.
- 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
Describe the bug
Description
When running
shadcn migrate radix, components using@radix-ui/react-slotare converted toimport { Slot as SlotPrimitive } from "radix-ui"andconst Comp = asChild ? SlotPrimitive.Slot : "button".In shadcn v4, components standardize on
import { Slot } from "radix-ui"andSlot.Root. UsingSlotPrimitive.Slotcauses inconsistency across registry components and breaks prop typing.Suggested Fix
In
packages/shadcn/src/migrations/migrate-radix.ts:SlotasSlotPrimitivewhen extracting imports.__SLOT_PLACEHOLDER__withSlot.Root.Affected component/components
Affected Files
packages/shadcn/src/migrations/migrate-radix.ts: - Lines 47–52 & 85–90: AliasesSlottoSlotPrimitive- Line 440: ReplacesSlotwithSlotPrimitive.SlotHow to reproduce
Steps to Reproduce
import { Slot } from "@radix-ui/react-slot".npx shadcn@latest migrate radix.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