migrate command runs automated migrations on your shadcn/ui components. Use it to update components when there are breaking changes or to adopt new features.
Usage
Arguments
The migration to run. Use
--list to see available migrations.Optional path or glob pattern to migrate. If not provided, migrates all components.
Options
The working directory. Defaults to the current directory.
List all available migrations.
Skip confirmation prompt.
Available migrations
icons
Migrate your UI components to a different icon library.radix
Migrate to Radix UI.rtl
Migrate your components to support RTL (right-to-left) languages.Examples
List available migrations
Run a specific migration
Migrate specific files
Migrate using glob pattern
Skip confirmation
Migrate in specific directory
Migration details
Icon library migration
Migrates components from one icon library to another. Common migrations:- Lucide React → Other icon libraries
- React Icons → Lucide React
- Updates import statements
- Replaces icon components
- Maintains icon props and styling
Radix UI migration
Migrates components to use Radix UI primitives. What it does:- Updates Radix UI package imports
- Adjusts component composition
- Updates event handlers and props
RTL migration
Adds right-to-left language support to components. What it does:- Adds direction-aware styling
- Updates logical properties (e.g.,
margin-left→margin-inline-start) - Adjusts layout for bidirectional support
- Updates icon positioning and animations
Before running migrations
1. Commit your changes
Always commit your code before running migrations:2. Review migration scope
Understand which files will be affected:3. Backup your components
After running migrations
1. Review changes
2. Test your components
Ensure all components work as expected:3. Update imports
Some migrations may require updating imports in your application code.4. Run tests
Requirements
- Valid
components.jsonfile in your project root - Project must not be empty
- Must run from project root or use
--cwd
Error handling
If migration fails:-
No components.json found
Solution: Run from project root or run
shadcn initfirst. -
Invalid migration
Solution: Check available migrations with
--list. -
Empty project
Solution: Initialize project with
shadcn init.
Notes
- Migrations modify files in place
- Always backup before running migrations
- Some migrations may require manual adjustments
- Review all changes before committing
- Migrations are idempotent (safe to run multiple times)