Agent Migration Guide - Incremental Migration with Coexistence
Incremental coexistence 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 using incremental coexistence migration. This approach allows v2 and v3 components to work side-by-side, enabling component-by-component migration while keeping the project functional.
Key Difference: Unlike full migration, incremental coexistence migration allows the project to remain functional during migration. Both v2 and v3 components can coexist temporarily.
Key Principles
- Incremental Component Migration: Migrate one component at a time, testing each before proceeding
- Project Remains Functional: Unlike full migration, the project should remain working throughout
- Strategy Identification: Determine which coexistence strategy the project uses (A: pnpm aliases or B: component packages)
- Component-by-Component Testing: Test each migrated component before moving to the next
- CSS Conflict Management: Monitor and resolve styling conflicts between v2 and v3 during coexistence
- Removed Components: v2 components with no v3 counterpart (Code, Image, Navbar, Ripple, Snippet, Spacer, User) can be left in place during coexistence. Do not migrate them unless the user explicitly asks to replace them.
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.
Incremental Migration Setup
For detailed setup and migration instructions, see the Incremental Migration Guide. The guide covers:
- Strategy selection (A: pnpm aliases or B: component packages)
- Detailed setup for each strategy
- CSS configuration for coexistence
- Component-by-component migration process
- CSS conflict handling
- Completing the migration
Strategy Identification
For projects using incremental coexistence strategies, agents should:
-
Identify the strategy: Check if project uses pnpm aliases (Strategy A) or component packages (Strategy B)
- Strategy A: Look for aliases like
"@heroui-v3/react": "npm:@heroui/react@latest"in package.json - Strategy B: Look for component-specific packages like
@heroui/button,@heroui/cardalongside@heroui/react
- Strategy A: Look for aliases like
-
Verify setup: Ensure the coexistence setup is correct:
- Strategy A: Both
@heroui/react(v2) and@heroui-v3/react(v3 alias) are installed - Strategy B:
@heroui/react(v3) and component packages like@heroui/button(v2) are installed - CSS is configured for both versions (see CSS Configuration section)
- Strategy A: Both
Component-by-Component Migration Guidance
For Strategy A (pnpm aliases):
-
Identify component to migrate
- Review the component migration reference table
- Use
get_component_migration_guidesMCP tool to fetch component-specific guide
-
Update imports
- Change imports from
@heroui/reactto@heroui-v3/react - Example:
import {Button} from "@heroui/react"βimport {Button} from "@heroui-v3/react"
- Change imports from
-
Update component code
- Follow component migration guide from
get_component_migration_guidestool - Update props, component structure, and API calls
- Replace hooks with compound components if needed
- Follow component migration guide from
-
Test the migrated component
- Verify component renders correctly
- Test functionality and interactions
- Check for styling conflicts
-
Document migration
- Track which components have been migrated
- Note any issues or concerns
For Strategy B (component packages):
-
Identify component to migrate
- Review the component migration reference table
- Use
get_component_migration_guidesMCP tool to fetch component-specific guide
-
Remove component package
- Remove the v2 component package from dependencies (e.g.,
@heroui/button) - Update package.json
- Remove the v2 component package from dependencies (e.g.,
-
Update imports
- Change imports from component package to
@heroui/react(v3) - Example:
import {Card} from "@heroui/card"βimport {Card} from "@heroui/react"
- Change imports from component package to
-
Update component code
- Follow component migration guide from
get_component_migration_guidestool - Update props, component structure, and API calls
- Replace hooks with compound components if needed
- Follow component migration guide from
-
Test the migrated component
- Verify component renders correctly
- Test functionality and interactions
- Check for styling conflicts
-
Document migration
- Track which components have been migrated
- Note any issues or concerns
Handling Removed Components (No v3 Counterpart)
When encountering v2 components with no v3 counterpart (Code, Image, Navbar, Ripple, Snippet, Spacer, User):
- Leave them in place β do not attempt to migrate them unless the user explicitly requests removal
- If the user wants to remove them: Use
get_component_migration_guides(where available) or the Component Migration Reference to fetch guides and help replace with native HTML or manual implementations
CSS Conflict Handling
During coexistence, both v2 and v3 CSS systems will be loaded. Agents should:
-
Monitor for conflicts
- Watch for styling inconsistencies
- Check if v2 and v3 styles are conflicting
- Verify both CSS imports are present and in correct order
-
Guide conflict resolution
- Ensure CSS import order:
tailwindcssfirst, then@heroui/styles - Check Tailwind config has v2 plugin configured
- Verify v3 CSS is imported correctly
- Ensure CSS import order:
-
Test styling after each migration
- Verify migrated components look correct
- Check for unexpected style overrides
- Ensure v2 components still styled correctly
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 β |
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 β |
Completion Steps
Once all components are migrated:
-
Remove v2 dependencies
- Strategy A: Remove
@heroui/react,@heroui/theme, and aliases - Strategy B: Remove all remaining
@heroui/*component packages - If the project contains v2 removed components (Code, Image, Navbar, Ripple, Snippet, Spacer, User), inform the user they may ask to remove them later using the provided guides.
- Strategy A: Remove
-
Update all imports
- Strategy A: Change
@heroui-v3/reactβ@heroui/react - Strategy B: All imports should already be
@heroui/react(v3)
- Strategy A: Change
-
Update CSS configuration
- Remove v2 Tailwind plugin from config
- Keep only
@import "@heroui/styles"; - Remove v2 CSS imports
-
Complete styling migration
- Follow the styling migration guide
- Use
get_styling_migration_guideMCP tool - Update utility classes, color tokens, etc.
Differences from Full Migration
Key Differences:
- Project State: Project remains functional during migration (no broken state)
- Migration Pace: Can migrate over extended period, component by component
- Testing: Can test v3 components alongside v2 before full migration
- Branch Strategy: Feature branch less critical (though still recommended)
- Dependency Management: Both versions coexist temporarily
- CSS Handling: Both CSS systems loaded during coexistence period
When to Use Incremental Coexistence:
- Large codebases that need gradual migration
- Projects that must remain functional during migration
- Teams that want to test v3 components incrementally
- Projects already using component-specific packages (Strategy B)
When to Use Full Migration:
- Smaller projects that can migrate quickly
- Projects where temporary broken state is acceptable
- Teams that prefer all-at-once migration
- Projects using unified
@heroui/reactpackage (Strategy A can work but full migration may be simpler)
Best Practices for Agents
-
Verify project remains functional
- After each component migration, ensure project still works
- Test both migrated and non-migrated components
- Report any issues immediately
-
Guide component-by-component migration
- Help migrate one component at a time
- Use
get_component_migration_guidesMCP tool for each component - Test thoroughly before proceeding
-
Monitor CSS conflicts
- Watch for styling issues between v2 and v3
- Guide resolution of conflicts
- Ensure CSS configuration is correct
-
Track migration progress
- Keep a checklist of migrated components
- Document any issues or concerns
- Note which strategy is being used
-
Guide completion steps
- Once all components migrated, guide removal of v2 dependencies
- Help update all imports to v3-only
- Guide styling migration completion
Common Scenarios
Large Project (100+ components)
- Migrate components incrementally over time
- Test each component thoroughly
- Monitor for CSS conflicts
- Can take weeks or months to complete
Small Project (<20 components)
- Can migrate more quickly
- Still test each component
- Less CSS conflict risk
- May complete in days
Mixed Strategy Projects
- Some projects may use Strategy A for some components, Strategy B for others
- Guide appropriate import updates for each component
- Ensure consistent approach where possible
Project Uses v2 Navbar (or Other Removed Components)
- Leave in place β v2 Navbar and other removed components (Code, Image, Ripple, Snippet, Spacer, User) will continue to work during coexistence
- Inform the user they can optionally remove them later with agent assistance and the Component Migration Reference guides
Next Steps
After completing migration:
- Remove v2 dependencies (already done in completion steps)
- Switch from Migration MCP to
heroui-reactMCP for v3 development - Update documentation references
- Run final verification
- Complete styling migration
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.