--- name: design-system-migration description: Migrate React design system from Radix UI to Base UI, then set up Mitosis for multi-framework compilation (React, Angular, Vue). Use when refactoring component libraries, migrating headless UI frameworks, or adding multi-framework support to design systems. --- # Design System Migration: Radix UI → Base UI → Mitosis ## Overview This skill orchestrates a two-phase migration: 1. **Phase 1**: Migrate from Radix UI to Base UI (modern React-only) 2. **Phase 2**: Set up Mitosis for multi-framework compilation ## Phase 1: Base UI Migration ### 1.1 Update Dependencies **Remove Radix packages:** - `@radix-ui/react-checkbox` - `@radix-ui/react-dialog` - `@radix-ui/react-label` - `@radix-ui/react-radio-group` - `@radix-ui/react-slot` - `@radix-ui/react-toast` - `@radix-ui/react-tooltip` **Add Base UI:** - `@base-ui/react@^1.1.0` ### 1.2 Component Migration Patterns #### Button: Radix Slot → Base UI Render Prop **Before (Radix):** ```tsx import * as Slot from '@radix-ui/react-slot'; const Comp = asChild ? Slot.Root : 'button'; {children} ``` **After (Base UI):** ```tsx // Option 1: Keep asChild for backward compatibility const Comp = asChild ? 'span' : 'button'; {children} // Option 2: Add render prop (new API) if (render) { return render(props); } ``` #### Checkbox: Nearly Identical Structure **Before (Radix):** ```tsx import * as CheckboxPrimitive from '@radix-ui/react-checkbox'; ``` **After (Base UI):** ```tsx import { Checkbox } from '@base-ui/react/checkbox'; ``` #### Input: Label → Field Component **Before (Radix):** ```tsx import * as Label from '@radix-ui/react-label'; {label} ``` **After (Base UI):** ```tsx import { Field } from '@base-ui/react/field'; {label} } /> // Or simpler: just use native