Skip to main content
The 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

string
The migration to run. Use --list to see available migrations.
string
Optional path or glob pattern to migrate. If not provided, migrates all components.

Options

string
The working directory. Defaults to the current directory.
boolean
default:"false"
List all available migrations.
boolean
default:"false"
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

Output:

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
What it does:
  • 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-leftmargin-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.json file in your project root
  • Project must not be empty
  • Must run from project root or use --cwd

Error handling

If migration fails:
  1. No components.json found
    Solution: Run from project root or run shadcn init first.
  2. Invalid migration
    Solution: Check available migrations with --list.
  3. 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)