Agent Migration Guide - Full Migration
Full migration guide for AI assistants helping migrate HeroUI v2 to v3
Overview
This guide is designed for AI assistants (agents) helping users migrate from HeroUI v2 to v3. It implements a full migration approach that analyzes the project first and migrates components in manageable batches rather than all at once.
Critical Constraint: HeroUI v2 and v3 should not coexist in the same project. The project will be broken during migration. Always work in a feature branch and migrate all component code before switching dependencies.
Key Principles
- Full Migration: Never migrate all components at once. Large projects require full migration.
- Project Analysis First: Always analyze the codebase to understand component usage before creating a migration plan.
- Broken State Management: Critical: The project will be broken during migration. Plan for this by:
- Migrating in a feature branch
- Preparing all code changes before switching dependencies
- Having a rollback plan
- Testing in isolated environment first
- All-or-Nothing Dependency Switch: Once dependencies are updated to v3, ALL components must be migrated. Plan component migrations before switching dependencies.
Major Changes in v3
Major Changes
- Dependencies: Update React to v19+, HeroUI packages to v3, Tailwind CSS to v4, remove Framer Motion
- No Provider Required: v3 removes the need for
HeroUIProvider - Component API Updates: Many components use React Aria Components patterns
- Compound Components: New compound component patterns for better customization. See individual component guides for details.
- Hooks Removed: v2 component hooks like
useSwitchoruseInputare removed - use compound components instead.useDisclosureis replaced withuseOverlayState. See the Hooks Migration Guide for details. - Configuration: Remove
heroui()plugin from Tailwind config, update CSS imports, removehero.tsfile - Item identity: Collection items (Dropdown, Listbox, Select, Accordion, etc.) now use
idandtextValuein v3; keep React'skeyfor lists.
Detailed Migration Steps
For detailed step-by-step instructions, see the Full Migration Guide. The guide covers:
- Dependency updates
- Theming configuration changes
- Removing HeroUIProvider
- Component imports and migration
- Hooks migration
- Styling migration
- Testing
Agent Note: Dependency updates (React 19, Tailwind v4) can be done before switching HeroUI (won't break project). However, the HeroUI package switch should only happen AFTER all component code is migrated.
Hooks Migration
HeroUI v2 provided component hooks (like useSwitch, useInput, useCheckbox, etc.) and utility hooks like useDisclosure. HeroUI v3 removes most component hooks in favor of compound components, and replaces useDisclosure with useOverlayState.
When to migrate hooks:
- During component migration: Replace component hooks (
useSwitch,useInput, etc.) as you migrate each component to use compound components - After component migration: Migrate
useDisclosure→useOverlayStatefor overlay state management before styling migration
Migration Strategy:
- Identify hook usage: Search codebase for imports from
@heroui/reactthat include hook names (useSwitch,useInput,useCheckbox,useRadio,useDisclosure, etc.) - Replace component hooks: Use compound components instead of hooks with prop getters (done during component migration)
- Replace useDisclosure: Migrate to
useOverlayStatefor overlay state management (useget_hooks_migration_guideMCP tool) - Reference guides: Use
get_hooks_migration_guideMCP tool for hooks migration,get_component_migration_guidesfor component-specific guides
Component Import Changes
See the Full Migration Guide for detailed component import changes.
Component Migration Reference
Use the table below to quickly find migration guidance for each component. Use the link in the "Migration Guide" column to jump to detailed migration instructions.
Component Development Status: Components marked with 🔄 In Progress or 📋 Planned are still being developed. Check the Roadmap for the task status. Guides for these components will be available once development is finished.
| v2 Component | v3 Component | Status | Migration Guide |
|---|---|---|---|
| Accordion | Accordion | ✅ Available | View guide → |
| Alert | Alert | ✅ Available | View guide → |
| Autocomplete | ComboBox | ✅ Renamed | View guide → |
| Avatar | Avatar | ✅ Available | View guide → |
| Badge | Badge | ✅ Available | View guide → |
| Breadcrumbs | Breadcrumbs | ✅ Available | View guide → |
| Button | Button | ✅ Available | View guide → |
| ButtonGroup | ButtonGroup | ✅ Available | View guide → |
| Calendar | Calendar | ✅ Available | View guide → |
| Card | Card | ✅ Available | View guide → |
| Checkbox | Checkbox | ✅ Available | View guide → |
| CheckboxGroup | CheckboxGroup | ✅ Available | View guide → |
| Chip | Chip | ✅ Available | View guide → |
| Code | ❌ | ❌ Removed | View guide → |
| DateInput | DateField | ✅ Renamed | View guide → |
| DatePicker | DatePicker | ✅ Available | View guide → |
| DateRangePicker | DateRangePicker | ✅ Available | View guide → |
| TimeInput | TimeField | ✅ Renamed | View guide → |
| Divider | Separator | ✅ Renamed | View guide → |
| Drawer | Drawer | ✅ Available | View guide → |
| Dropdown | Dropdown | ✅ Available | View guide → |
| Form | Form | ✅ Available | View guide → |
| Image | ❌ | ❌ Removed | View guide → |
| Input | TextField, Input, InputGroup | ✅ Available | View guide → |
| InputOTP | InputOTP | ✅ Available | View guide → |
| Kbd | Kbd | ✅ Available | View guide → |
| Link | Link | ✅ Available | View guide → |
| Listbox | ListBox | ✅ Available | View guide → |
| Modal | Modal | ✅ Available | View guide → |
| Navbar | ❌ | ❌ Removed | View guide → |
| NumberInput | NumberField | ✅ Renamed | View guide → |
| Pagination | Pagination | ✅ Available | View guide → |
| Popover | Popover | ✅ Available | View guide → |
| Progress | ProgressBar | ✅ Renamed | View guide → |
| CircularProgress | ProgressCircle | ✅ Renamed | View guide → |
| Radio | Radio | ✅ Available | View guide → |
| RadioGroup | RadioGroup | ✅ Available | View guide → |
| RangeCalendar | RangeCalendar | ✅ Available | View guide → |
| Ripple | ❌ | ❌ Removed | See Button ripple → |
| ScrollShadow | ScrollShadow | ✅ Available | View guide → |
| Select | Select | ✅ Available | View guide → |
| Skeleton | Skeleton | ✅ Available | View guide → |
| Slider | Slider | ✅ Available | View guide → |
| Snippet | ❌ | ❌ Removed | View guide → |
| Spacer | ❌ | ❌ Removed | View guide → |
| Spinner | Spinner | ✅ Available | View guide → |
| Switch | Switch | ✅ Available | View guide → |
| Table | Table | ✅ Available | View guide → |
| Tabs | Tabs | ✅ Available | View guide → |
| Toast | Toast | ✅ Available | View guide → |
| Tooltip | Tooltip | ✅ Available | View guide → |
| User | ❌ | ❌ Removed | View guide → |
Removed/In-Progress/Planned Components: For components marked as ❌ Removed, 🔄 In Progress, or 📋 Planned, replace them with standard HTML elements during migration. You can migrate back to HeroUI components once they become available in v3.
Use the get_component_migration_guides MCP tool to fetch detailed guides for each component.
New Components in v3
New Components in v3
v3 introduces a number of new components not available in v2:
| Component | Purpose | Documentation |
|---|---|---|
| TextField | Enhanced text input with label and description support | View docs → |
| TextArea | Multi-line text input component | View docs → |
| AlertDialog | Modal dialog for confirmations and alerts | View docs → |
| Label | Accessible form label component | View docs → |
| Description | Helper text for form fields | View docs → |
| FieldError | Form field error message display | View docs → |
| Fieldset | Group related form fields | View docs → |
| InputGroup | Compose multiple inputs together | View docs → |
| Surface | Container component with elevation styles | View docs → |
| Disclosure | Expandable/collapsible content sections | View docs → |
| DisclosureGroup | Compound component for multiple disclosure sections | View docs → |
| SearchField | Search input with clear button and optional loading state | View docs → |
| DateField | Date input with calendar picker | View docs → |
| TimeField | Time input component | View docs → |
| Tag, TagGroup | Tags and tag group for selection or display | View docs → |
| ColorPicker | Color selection (ColorArea, ColorField, ColorSlider, ColorSwatch, ColorSwatchPicker) | View docs → |
| CloseButton | Dismiss or close trigger button | View docs → |
| ErrorMessage | Form field error display (React Aria integration) | View docs → |
Custom Theme Overrides
See the Full Migration Guide for custom theme override migration.
Styling Migration
See the Full Migration Guide for detailed styling migration instructions.
Agent Note: Use the get_styling_migration_guide MCP tool for comprehensive styling migration details.
Important: Styling migration happens AFTER component migration and dependency switch.
Full Migration Workflow
IMPORTANT: Since v2 and v3 cannot coexist, the migration happens in two main stages:
- Preparation Stage: Migrate all component code while still on v2 dependencies (code will be broken)
- Switch Stage: Update dependencies to v3 and fix any remaining issues
⚠️ CRITICAL: Don't build to check for errors during migration
- Use typecheck (e.g.,
tsc --noEmit) if available to check TypeScript errors - Use lint (e.g.,
eslint,biome check) if available to check code quality - DO NOT run build commands (e.g.,
npm run build,next build,vite build) - DO NOT attempt to start/run the project during migration
Phase 0: Setup and Analysis
-
Create migration branch
- Create a feature branch for migration work
- Example:
git checkout -b migrate/heroui-v3
-
Verify Migration MCP is configured
- Check that Migration MCP server is connected
- Ensure
heroui-reactMCP is NOT connected (to avoid confusion) - Verify MCP tools are available
-
Analyze the project and create a migration plan
- Use
get_migration_workflowto fetch this guide - Scan for HeroUI v2 imports, identify all components and usage
- Map component dependencies
- Create a phased migration plan (e.g., 3-5 components per phase, by-dependency strategy)
- Use
Phase 1: Dependency Preparation (Before Code Changes)
These steps can be done before switching HeroUI dependencies and won't break the project:
-
Update React to v19 (if not already)
- This can be done before switching HeroUI
-
Update Tailwind CSS to v4 (if not already)
- This can be done before switching HeroUI
-
🛑 CHECKPOINT: Stop and wait for user approval
- DO NOT proceed to next phase automatically
- Explain configuration changes
- Wait for explicit user approval before continuing
Phase 2-N: Code Migration (v2 Dependencies Still Active)
Critical: During this phase, code will reference v3 APIs but v2 dependencies are still installed. The project will be broken. This is expected and normal.
For each component group in the migration plan:
-
Fetch component-specific guides
- Use
get_component_migration_guidesMCP tool for each component - Review API changes, prop migrations, structure changes
- Use
-
Apply code migrations
- Migrate component code to v3 API patterns
- Update imports, props, component structure
- Note: Code will be broken until dependencies are switched
-
Handle dependencies
- If components have dependencies, migrate dependencies first
- Check if dependencies are already migrated
- Migrate shared code as needed
-
🛑 CHECKPOINT: Stop and wait for user approval
- DO NOT proceed to next phase automatically
- Summarize what was migrated in this phase
- Wait for explicit user approval before continuing
-
Document migration status
- Track which components have been migrated
- Note any issues or concerns
Phase Final: Dependency Switch and Fixes
Critical: Only proceed when ALL components have been migrated to v3 API patterns.
-
Update dependencies
- Remove
@heroui/reactand@heroui/theme(v2) - Install
@heroui/reactand@heroui/styles(v3) - Remove
framer-motionif present - Update CSS imports (add
@import "@heroui/styles";) - Remove HeroUIProvider from app root
- Update Tailwind config (remove
heroui()plugin)
- Remove
-
Fix remaining issues
- Run typecheck/lint if available (do NOT build)
- Fix any TypeScript errors reported by typecheck
- Fix any linting errors
- Note: Do not attempt to build or run the project during migration
-
🛑 CHECKPOINT: Stop and wait for user approval
- DO NOT proceed to styling automatically
- Verify components work correctly
- Wait for explicit user approval before styling migration
-
Continue with styling migration
- Use
get_styling_migration_guideMCP tool to fetch styling guide - Apply styling updates systematically
- Use
-
Apply styling updates
- Use
get_styling_migration_guideMCP tool - Update utility classes, color tokens, CSS variables
- Test visual appearance
- Use
-
Final verification
- Run typecheck/lint one final time (do NOT build)
- Verify all styling updated correctly
- Note: Full testing (visual, functionality, accessibility) should be done after migration is complete, not during migration
Migration Strategies
Strategy 1: By Dependency (Recommended)
- Migrate foundational components first (Button, Input, Card, etc.)
- Then migrate components that depend on them
- Best for projects with complex component hierarchies
- Ensures dependencies are ready before dependents
Example order:
- Button, Input, Link (foundational)
- Card, Modal (use Button)
- Form, Dropdown (use Input, Button)
- Complex components (use multiple dependencies)
Strategy 2: By Feature
- Migrate all components in a feature/module together
- Good for feature-based code organization
- Allows feature-by-feature testing
- May require migrating dependencies first
Example:
- Feature: User Authentication
- Migrate: Input, Button, Form, Modal (all auth-related)
- Feature: Dashboard
- Migrate: Card, Tabs, Select (all dashboard-related)
Strategy 3: By Frequency
- Migrate most-used components first
- Provides quick wins and early validation
- Good for large codebases with clear usage patterns
- Still need to handle dependencies
Example:
- Button (used 150 times)
- Input (used 120 times)
- Card (used 80 times)
- ... (continue by usage count)
Best Practices for Agents
-
Warn about broken state
- Always inform user that project will be broken during migration
- Recommend using a feature branch
- Set expectations about when project will work again
-
Migrate all code before switching dependencies
- Complete all component code migrations first
- Only switch dependencies when ALL components are migrated
- This minimizes the broken state duration
-
Use MCP tools for each phase
- Use
get_migration_workflow,get_component_migration_guides,get_styling_migration_guideas needed - Critical: Always stop at checkpoints and wait for user approval between phases
- Use
-
Work in a feature branch
- Always recommend creating a migration branch
- Allow user to continue working on main branch
- Enable easy rollback if needed
-
Document migration status
- Track which components have been migrated
- Note any issues or concerns
- Keep a checklist visible
- Update status after each phase
-
Handle errors gracefully
- If a component migration fails, document why
- Continue with other components
- Return to failed components after dependency switch
- Some issues may resolve once dependencies are updated
-
Verify after dependency switch
- Only after dependencies are updated to v3
- Run typecheck/lint (do NOT build)
- Fix type/lint errors as they arise
- Don't proceed to styling until typecheck/lint passes
Common Scenarios
Large Project (100+ components)
- Use smaller batch sizes (3-5 components)
- Prioritize by dependency or frequency
- Allow for multiple sessions
- Create checkpoints between phases
- Use "by-dependency" strategy
- Document progress clearly
Small Project (<20 components)
- Can use larger batches (5-10 components)
- May complete in fewer phases
- Still verify incrementally (full migration approach)
- Can use any strategy
- Still need to migrate all code before switching deps
Mixed v2/v3 Usage (Full Migration)
- Not possible in full migration: v2 and v3 cannot coexist in full migration approach
- Must migrate all components before switching dependencies
- Use feature branch to maintain working main branch
- Complete migration in one go
Next Steps
After completing migration:
- Remove v2 dependencies (already done in dependency switch)
- Switch from Migration MCP to
heroui-reactMCP for v3 development - Update documentation references
- Run final verification
- Merge migration branch to main
This agent migration guide is designed to work with the Migration MCP server. Ensure the MCP server is properly configured and tools are available before starting migration.