Skip to content

Migration Guide ​

Migrating to the Acrobi Design System from other component libraries or legacy systems. This guide provides step-by-step instructions, automated tools, and migration strategies.

🎯 Overview ​

The Acrobi Design System is designed to make migration as smooth as possible with:

  • Incremental adoption - Migrate components gradually
  • Coexistence support - Run alongside existing systems
  • Automated migration tools - CLI helpers for common patterns
  • Comprehensive mapping - Clear equivalents for popular libraries

πŸ—ΊοΈ Migration Strategies ​

Gradually replace components over time while maintaining existing functionality:

tsx
// Phase 1: Install alongside existing system
npm install @acrobi/ui

// Phase 2: Start with new components
import { Button } from '@acrobi/ui';
import { Card } from '@my-old-ui'; // Keep existing

// Phase 3: Replace components one by one
import { Button, Card } from '@acrobi/ui'; // Both migrated

Strategy 2: Parallel Implementation ​

Run both systems side-by-side during transition:

tsx
// Use CSS prefixes to avoid conflicts
.acrobi-components {
  /* Acrobi components scope */
}

.legacy-components {
  /* Legacy components scope */
}

Strategy 3: Complete Replacement ​

Full migration for greenfield projects or major refactors:

tsx
// Remove old dependencies
npm uninstall @old-ui/core @old-ui/components

// Install Acrobi
npm install @acrobi/ui

// Update all imports at once
import { Button, Card, Input } from '@acrobi/ui';

πŸ“š Component Mapping ​

From Material-UI (MUI) ​

MUI ComponentAcrobi EquivalentMigration Notes
ButtonButtonDirect replacement with similar API
TextFieldTextFieldEnhanced validation and accessibility
CardCardMore flexible composition pattern
TypographyHeadline, Paragraph, TextSemantic-focused approach
DataGridDataTableSimpler API, built-in features
AutocompleteSelectField with searchableMore straightforward implementation
ChipChip, TagBoth available for different use cases
DialogDialogEnhanced focus management
FormControlField components (TextField, etc.)All-in-one field components
GridCSS Grid / FlexboxUtility-first approach with Tailwind

Migration Example: MUI to Acrobi ​

tsx
// Before: Material-UI
import {
  Button,
  TextField,
  FormControl,
  FormLabel,
  FormHelperText,
  Card,
  CardContent,
  Typography
} from '@mui/material';

function MUIForm() {
  return (
    <Card>
      <CardContent>
        <Typography variant="h5">Contact Form</Typography>
        <FormControl fullWidth margin="normal">
          <FormLabel>Email</FormLabel>
          <TextField 
            type="email"
            helperText="We'll never share your email"
          />
        </FormControl>
        <Button variant="contained">Submit</Button>
      </CardContent>
    </Card>
  );
}

// After: Acrobi Design System
import { 
  Button, 
  TextField, 
  Card, 
  CardHeader,
  CardTitle,
  CardContent 
} from '@acrobi/ui';

function AcrobiForm() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>Contact Form</CardTitle>
      </CardHeader>
      <CardContent>
        <TextField
          label="Email"
          type="email"
          helperText="We'll never share your email"
        />
        <Button>Submit</Button>
      </CardContent>
    </Card>
  );
}

From Ant Design ​

Ant DesignAcrobi EquivalentMigration Notes
ButtonButtonSimilar variants, enhanced accessibility
InputTextFieldComplete field solution with validation
Form.ItemField componentsBuilt-in label and validation
TableDataTableSimplified API, better performance
SelectSelectFieldEnhanced search and accessibility
CardCardMore flexible composition
Typography.TitleHeadlineSemantic heading levels
Typography.TextText, ParagraphMore granular control
ModalDialogEnhanced focus and accessibility
UploadUploadFieldComplete upload solution

Migration Example: Ant Design to Acrobi ​

tsx
// Before: Ant Design
import { 
  Button, 
  Form, 
  Input, 
  Select, 
  Card, 
  Typography 
} from 'antd';

const { Title } = Typography;
const { Option } = Select;

function AntdForm() {
  return (
    <Card>
      <Title level={3}>User Form</Title>
      <Form layout="vertical">
        <Form.Item 
          label="Name" 
          rules={[{ required: true, message: 'Please input your name!' }]}
        >
          <Input />
        </Form.Item>
        <Form.Item label="Role">
          <Select placeholder="Select a role">
            <Option value="admin">Admin</Option>
            <Option value="user">User</Option>
          </Select>
        </Form.Item>
        <Form.Item>
          <Button type="primary" htmlType="submit">
            Submit
          </Button>
        </Form.Item>
      </Form>
    </Card>
  );
}

// After: Acrobi Design System
import { 
  Button, 
  TextField, 
  SelectField,
  Card,
  CardHeader,
  CardTitle,
  CardContent
} from '@acrobi/ui';

function AcrobiForm() {
  return (
    <Card>
      <CardHeader>
        <CardTitle level="h3">User Form</CardTitle>
      </CardHeader>
      <CardContent className="space-y-4">
        <TextField
          label="Name"
          required
          error="Please input your name!"
        />
        <SelectField
          label="Role"
          placeholder="Select a role"
          options={[
            { value: 'admin', label: 'Admin' },
            { value: 'user', label: 'User' }
          ]}
        />
        <Button type="submit">Submit</Button>
      </CardContent>
    </Card>
  );
}

From Chakra UI ​

Chakra UIAcrobi EquivalentMigration Notes
ButtonButtonSimilar size and variant system
InputTextFieldEnhanced with built-in validation
FormControlField componentsAll-in-one approach
Boxdiv with Tailwind classesUtility-first styling
TextText, ParagraphMore semantic options
HeadingHeadlineSemantic heading levels
VStack, HStackFlexbox utilitiesTailwind utility classes
ModalDialogEnhanced accessibility
useDisclosureuseStateStandard React patterns
useToastCustom implementationUse notification libraries

From Bootstrap Components ​

BootstrapAcrobi EquivalentMigration Notes
btnButtonEnhanced variants and accessibility
form-controlTextField, SelectFieldComplete field solutions
cardCardMore flexible composition
modalDialogBetter focus management
navBreadcrumb, custom navigationSemantic navigation components
tableDataTableFeature-rich data display
alertBannerEnhanced dismissal and actions
badgeBadge, TagMultiple options available
dropdownSelectField, DialogContext-appropriate solutions
Utility classesTailwind CSS classesModern utility-first approach

πŸ› οΈ Migration Tools ​

CLI Migration Assistant ​

The Acrobi CLI provides migration helpers:

bash
# Analyze existing components
npx @acrobi/cli migrate analyze ./src

# Generate migration report
npx @acrobi/cli migrate report --from mui

# Auto-migrate simple components
npx @acrobi/cli migrate auto --from antd --path ./src/components

# Create migration checklist
npx @acrobi/cli migrate checklist

Codemod Scripts ​

Automated code transformations for common patterns:

bash
# Install transformation tools
npm install -g jscodeshift

# Run Acrobi codemods
npx @acrobi/codemods mui-to-acrobi ./src
npx @acrobi/codemods antd-to-acrobi ./src
npx @acrobi/codemods bootstrap-to-acrobi ./src

Migration Configuration ​

Create a migration config file:

json
// migration.config.json
{
  "from": "mui",
  "target": "@acrobi/ui",
  "rules": {
    "Button": {
      "component": "Button",
      "propMapping": {
        "variant": {
          "contained": "default",
          "outlined": "outline",
          "text": "ghost"
        }
      }
    },
    "TextField": {
      "component": "TextField", 
      "wrapFormControl": false
    }
  },
  "ignore": ["./src/legacy/**"],
  "typescript": true
}

πŸ”§ Step-by-Step Migration Process ​

Phase 1: Preparation ​

  1. Audit Current Components

    bash
    # Generate component inventory
    npx @acrobi/cli migrate analyze ./src --export components.json
  2. Install Acrobi System

    bash
    npm install @acrobi/ui
    npx @acrobi/cli init
  3. Setup Tailwind CSS

    js
    // tailwind.config.js
    module.exports = {
      presets: [require('@acrobi/ui/tailwind')],
      content: [
        './src/**/*.{js,ts,jsx,tsx}',
        './node_modules/@acrobi/ui/**/*.{js,ts,jsx,tsx}',
      ],
    };

Phase 2: Coexistence Setup ​

  1. Namespace CSS (if needed)

    css
    /* Wrap legacy components */
    .legacy-ui {
      /* Original CSS scope */
    }
    
    /* Acrobi components use default scope */
  2. Create Component Aliases (temporary)

    tsx
    // components/AcrobiButton.tsx
    export { Button as AcrobiButton } from '@acrobi/ui';
    
    // components/LegacyButton.tsx  
    export { Button as LegacyButton } from '@old-ui/core';

Phase 3: Incremental Migration ​

  1. Start with Leaf Components

    tsx
    // Migrate simple components first
    // βœ… Good: Start with Button, Badge, Tag
    // ❌ Avoid: Complex forms or data tables initially
  2. Update Component by Component

    tsx
    // Before
    import { Button } from '@old-ui/core';
    
    // After  
    import { Button } from '@acrobi/ui';
  3. Handle Prop Differences

    tsx
    // Create adapter if needed
    function MigratedButton({ variant, ...props }) {
      const acrobiVariant = variant === 'contained' ? 'default' : variant;
      return <Button variant={acrobiVariant} {...props} />;
    }

Phase 4: Advanced Components ​

  1. Migrate Complex Components

    tsx
    // Data tables, forms, modals
    import { DataTable, TextField, Dialog } from '@acrobi/ui';
  2. Update Styling Approach

    tsx
    // Before: CSS-in-JS or custom CSS
    const StyledButton = styled.button`
      background: blue;
      padding: 8px 16px;
    `;
    
    // After: Tailwind utilities
    <Button className="bg-blue-500 px-4 py-2">Click me</Button>

Phase 5: Cleanup ​

  1. Remove Old Dependencies

    bash
    npm uninstall @old-ui/core @old-ui/components
  2. Update Tests

    tsx
    // Update test imports and assertions
    import { render } from '@testing-library/react';
    import { Button } from '@acrobi/ui';
  3. Clean Up Styles

    css
    /* Remove old CSS imports */
    /* @import '@old-ui/core/dist/styles.css'; */

🎨 Styling Migration ​

From CSS-in-JS to Tailwind ​

tsx
// Before: Styled Components
const StyledCard = styled.div`
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  
  &:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  }
`;

// After: Tailwind + Acrobi Card
<Card className="hover:shadow-lg transition-shadow">
  <CardContent>
    Content here
  </CardContent>
</Card>

From CSS Modules ​

css
/* Before: styles.module.css */
.container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.button {
  background: #007bff;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
}
tsx
// Before: CSS Modules
import styles from './styles.module.css';

function Component() {
  return (
    <div className={styles.container}>
      <button className={styles.button}>Click me</button>
    </div>
  );
}

// After: Tailwind + Acrobi
import { Button } from '@acrobi/ui';

function Component() {
  return (
    <div className="flex flex-col gap-4 max-w-2xl mx-auto">
      <Button>Click me</Button>
    </div>
  );
}

πŸ§ͺ Testing Migration ​

Update Test Utilities ​

tsx
// Before: Old UI test utils
import { render, screen } from '@testing-library/react';
import { ThemeProvider } from '@old-ui/core';

const renderWithTheme = (component) => {
  return render(
    <ThemeProvider theme={theme}>
      {component}
    </ThemeProvider>
  );
};

// After: Acrobi test utils
import { render, screen } from '@testing-library/react';
import { themes, themeToCSSProperties } from '@acrobi/ui';

const renderWithTheme = (component) => {
  const cssProps = themeToCSSProperties(themes.acrobi);
  return render(
    <div style={cssProps}>
      {component}
    </div>
  );
};

Update Component Tests ​

tsx
// Before: Testing old components
test('renders button with correct text', () => {
  render(<OldButton variant="primary">Click me</OldButton>);
  expect(screen.getByRole('button')).toHaveTextContent('Click me');
  expect(screen.getByRole('button')).toHaveClass('btn-primary');
});

// After: Testing Acrobi components
test('renders button with correct text', () => {
  render(<Button variant="default">Click me</Button>);
  expect(screen.getByRole('button')).toHaveTextContent('Click me');
  expect(screen.getByRole('button')).toHaveClass('bg-primary');
});

🚨 Common Migration Issues ​

Issue 1: CSS Conflicts ​

Problem: Styles from old and new systems conflict

Solution: Use CSS scoping or namespacing

css
/* Scope legacy styles */
.legacy-app {
  /* Old styles only apply here */
}

/* New styles in default scope */

Issue 2: Different Event Handlers ​

Problem: Event handler signatures differ between systems

Solution: Create adapter functions

tsx
// Adapter for different onChange signatures
function adaptedOnChange(acrobiOnChange) {
  return (oldEvent) => {
    const acrobiEvent = {
      target: { value: oldEvent.currentTarget.value }
    };
    acrobiOnChange(acrobiEvent);
  };
}

Issue 3: Missing Components ​

Problem: Old system has components not in Acrobi

Solution: Build custom components using Acrobi primitives

tsx
// Custom component using Acrobi primitives
function CustomDataGrid({ data, columns }) {
  return (
    <DataTable
      data={data}
      columns={columns}
      // Add missing features as needed
    />
  );
}

Issue 4: Theme Differences ​

Problem: Color schemes and spacing don't match

Solution: Create custom theme

tsx
import { Theme } from '@acrobi/ui';

const migrationTheme: Theme = {
  name: 'migration',
  tokens: {
    colors: {
      primary: { 
        light: '220 100% 50%', // Match old primary
        dark: '220 100% 60%' 
      },
      // ... match other old colors
    },
    spacing: {
      // Match old spacing scale
      xs: '4px',
      sm: '8px', 
      md: '16px',
      lg: '24px',
      xl: '32px',
    },
    // ... other tokens
  },
};

πŸ“‹ Migration Checklist ​

Pre-Migration ​

  • [ ] Audit existing components and create inventory
  • [ ] Identify high-risk/complex components
  • [ ] Set up testing environment
  • [ ] Create migration timeline
  • [ ] Install Acrobi Design System
  • [ ] Configure Tailwind CSS

During Migration ​

  • [ ] Start with simple leaf components
  • [ ] Update one component type at a time
  • [ ] Run tests after each component migration
  • [ ] Handle styling conflicts as they arise
  • [ ] Update documentation
  • [ ] Get team review on migrated components

Post-Migration ​

  • [ ] Remove old dependencies
  • [ ] Clean up unused CSS
  • [ ] Update all tests
  • [ ] Verify accessibility compliance
  • [ ] Performance testing
  • [ ] Update build processes
  • [ ] Train team on new system

πŸ†˜ Getting Help ​

Migration Support Resources ​

Migration Services ​

For complex migrations, consider our professional services:

  • Migration Assessment - Analyze your current system and create migration plan
  • Automated Migration - Custom codemods for your specific use case
  • Team Training - On-site or remote training for development teams
  • Ongoing Support - Extended support during migration period

πŸ“ˆ Migration Success Stories ​

Case Study 1: E-commerce Platform ​

  • Before: 200+ components across MUI, Ant Design, and custom code
  • Timeline: 3 months incremental migration
  • Results: 40% reduction in bundle size, 60% fewer accessibility issues
  • Key Success Factor: Started with design tokens alignment

Case Study 2: SaaS Dashboard ​

  • Before: Legacy Bootstrap + jQuery components
  • Timeline: 6 weeks complete replacement
  • Results: Modern React architecture, full TypeScript support
  • Key Success Factor: Comprehensive testing strategy

Case Study 3: Mobile-First PWA ​

  • Before: Custom component library
  • Timeline: 2 months with PWA feature additions
  • Results: Added camera, geolocation, and offline capabilities
  • Key Success Factor: Leveraged Acrobi PWA hooks from day one

Ready to migrate? Start with our CLI migration assistant or join our Discord for real-time migration support.

Migration questions? We're here to help every step of the way!

Released under the MIT License.