mcpField
S
shadcn-migration

shadcn-migration

github.com/fusengineDevelopment3443 installsUpdated 2w ago
Repository

About shadcn-migration

shadcn-migration is a migration guide for Radix UI and Base UI primitives in shadcn/ui, with related CLI migration commands. It serves developers maintaining React components with migration order, API mappings, and validation checklists.

Key features

  1. 01Radix UI and Base UI migration guides
  2. 02Pre-migration checks and component inventory
  3. 03Migration order by component complexity
  4. 04Primitive API mapping table
  5. 05CLI migration command reference
  6. 06Post-migration validation checklist

Use cases

  1. 01Move component primitives from Radix UI to Base UI
  2. 02Migrate a project back to Radix UI
  3. 03Run icon or RTL migrations
  4. 04Migrate components incrementally and check tests

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/fusengine/agents --skill shadcn-migration

After installing, type/shadcn-migrationin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
baseui-to-radix.md
radix-to-baseui.md
references/templates/
migration-dialog.md

Details

From the project README
A step-by-step migration guide between Radix UI and Base UI primitives for shadcn/ui (React Aria, the third base, has no documented migration path), plus the CLI migrations (`migrate radix|cn|rtl|icons|base-color`): pre-migration checklist (detection, backup branch, component inventory), migration order (leaf components first — Tooltip/Switch/Checkbox, then Accordion/Tabs, then Dialog/Select/Popover/Menu), the API transformation table (`asChild`→`render`, `DialogContent`→`Dialog.Popup`, `data-state`→`data-[open]`, etc.), and a post-migration validation checklist.

shadcn Migration

Agent Workflow (MANDATORY)

Before migration, spawn agents in parallel, one Agent call each with a name:

  1. fuse-ai-pilot:explore-codebase - Inventory all affected components
  2. fuse-ai-pilot:research-expert - Verify migration patterns via Context7

After: Run fuse-ai-pilot:sniper for validation.


Overview

FeatureDescription
Radix -> Base UIOptional: Base UI is the default for new projects since July 2026; Radix is NOT deprecated
Base UI -> RadixMigrate to the Radix base (still fully supported)
React AriaThird base (aria-*, July 2026); no documented migration path to or from it; "existing projects stay on their current base"
API mappingComplete transformation table
ValidationPost-migration checklist
Official migration tooling
NeedCommand / toolSource
Radix -> Base UI, per componentnpx skills add shadcn/ui, then ask the agent "migrate accordion to base-ui" (progressive, one commit per component, report in .migration/<component>.md)changelog 2026-07-base-ui-default
@radix-ui/react-* -> unified radix-ui{runner} shadcn@latest migrate radix [path]/docs/cli#migrate-radix
clsx + tailwind-merge -> cn package{runner} shadcn@latest migrate cn [path] (merge engine targets Tailwind v4 like tailwind-merge v3; on Tailwind v3 keep tailwind-merge v2, a clsx-only migration is safe; no components.json needed)/docs/cli#migrate-cn
Physical -> logical classes (RTL){runner} shadcn@latest migrate rtl [path]/docs/cli#migrate-rtl
Icon library swap{runner} shadcn@latest migrate icons --from lucide --to phosphor/docs/cli#migrate-icons
Base color swap{runner} shadcn@latest migrate base-color --to zinc/docs/cli#migrate-base-color
Keep Radix in non-interactive CI init{runner} shadcn@latest init -b radix (default base is now base)changelog 2026-07-base-ui-default

{runner} shadcn@latest migrate --list prints the available migrations (CLI 4.21.0: cn, icons, base-color, radix, rtl).

Critical Rules

  1. ALWAYS run detection before starting migration
  2. ALWAYS create backup branch before migration
  3. MIGRATE one component type at a time
  4. UPDATE CSS selectors along with JSX changes
  5. RUN tests after each component migration

Architecture

Migration order (leaf components first):
1. Tooltip, Switch, Checkbox (simple)
2. Accordion, Tabs (medium)
3. Dialog, Select, Popover, Menu (complex)

-> See migration-dialog.md for complete example


Pre-Migration Checklist

[ ] Run shadcn-detection to confirm current primitive
[ ] Create backup branch (git checkout -b pre-migration)
[ ] Inventory all affected files (Grep for imports)
[ ] Review component-specific API changes
[ ] Plan migration order (leaf components first)

Migration Workflow

1. DETECT  -> Run shadcn-detection skill
2. BACKUP  -> Create git branch
3. INVENTORY -> List all affected components
4. TRANSFORM -> Apply API changes per component
5. VALIDATE -> Run tests + sniper check

Key API Changes

AspectRadixBase UI
CompositionasChildrender prop
Dialog content (primitive)Dialog.ContentDialog.Popup (shadcn wrapper keeps DialogContent)
Dialog overlay (primitive)Dialog.OverlayDialog.Backdrop (wrapper keeps DialogOverlay)
PositioningBuilt-inSeparate Positioner
Accordion body (primitive)Accordion.ContentAccordion.Panel (wrapper keeps AccordionContent)
Accordion single/multitype="single" collapsible / type="multiple"defaultValue={[...]} / multiple
Raw data attrsdata-state="open"data-open (Tailwind data-open: variant matches both)
Packageradix-ui (or legacy @radix-ui/react-*)Single @base-ui/react
components.json styleradix-* (legacy new-york)base-*

Best Practices

DO
  • Migrate one component type at a time
  • Run tests after each component migration
  • Update CSS selectors along with JSX
  • Remove unused Radix packages after migration
DON'T
  • Migrate all components at once
  • Skip detection step
  • Leave mixed APIs in production
  • Forget to update data-attribute CSS selectors

Reference Guide

Concepts
TopicReferenceWhen to Consult
Radix -> Base UIradix-to-baseui.mdMigrating from Radix
Base UI -> Radixbaseui-to-radix.mdMigrating to Radix
Templates
TemplateWhen to Use
migration-dialog.mdComplete migration example

Comments

Markdown supported