• Jan 15, 2026
  • 4 min read

From Bootstrap to custom design system: a migration strategy

From Bootstrap to custom design system

Introduction

Bootstrap has been the default UI framework for many products over the last decade. It speeds up early development, provides a large set of components, and simplifies grid layout and spacing. But as products mature, Bootstrap often becomes limiting—especially when teams need unique branding, more flexible components, or a scalable design system.

Migrating from Bootstrap to a custom design system requires careful planning. A complete rewrite can be risky, but a step-by-step migration allows you to modernize your UI without breaking existing features. This article outlines a safe, incremental strategy that helps teams replace Bootstrap with custom components while maintaining consistency across the UI.

You’ll learn how to:

  • Audit your existing Bootstrap usage
  • Map Bootstrap components to custom equivalents
  • Build design tokens and a core foundation
  • Replace components progressively
  • Avoid regressions through automated testing

1. Audit your Bootstrap usage

Before migrating, identify:

  • Which components are used most frequently
  • Repeated patterns and common UI structures
  • Custom overrides in your CSS
  • Pain points (e.g., spacing conflicts, override complexity)

Run a simple search for Bootstrap classes:

grep -R "class=.*btn" src/
grep -R "class=.*col-" src/
grep -R "class=.*alert" src/

Build a usage matrix

Bootstrap ComponentFrequencyReplacement PriorityNotes
.btnVery highHighMultiple variants
.alertMediumMediumReplace with custom feedback component
.modalLowLowReplace later
Grid systemVery highHighReplace with CSS Grid / Flex

2. Build your design system foundation

Before replacing UI components, create the foundation:

a) Design tokens

// tokens.scss
$color-primary: #4f46e5;
$color-secondary: #64748b;
$radius-md: 8px;
$spacing-md: 16px;
$font-sans: "Inter", sans-serif;

Convert to CSS variables for runtime flexibility:

:root {
  --color-primary: #4f46e5;
  --color-secondary: #64748b;
  --radius-md: 8px;
  --spacing-md: 16px;
}

b) Typography scale

Define font sizes, line heights, and headings.

c) Layout utilities

Replace Bootstrap spacing utilities with custom ones:

.mt-md { margin-top: var(--spacing-md); }
.p-md { padding: var(--spacing-md); }

3. Build equivalent custom components

Map Bootstrap components to your own system.

a) Replace buttons

Bootstrap:

<button class="btn btn-primary">Save</button>

Custom React component:

export function Button({ children, variant = "primary", ...props }) {
  return (
    <button
      className={`btn-${variant}`}
      {...props}
    >
      {children}
    </button>
  );
}
.btn-primary {
  background: var(--color-primary);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

b) Replace alerts

Bootstrap:

<div class="alert alert-success">Success!</div>

Custom:

export function Alert({ type, message }) {
  return (
    <div className={`alert alert-${type}`}>
      {message}
    </div>
  );
}

4. Gradual, safe replacement strategy

Step 1: Introduce new design tokens

Refactor colors, spacing, and typography across the project.

Step 2: Replace high-usage components

Start with buttons, form fields, and grid layout.

Step 3: Replace layout utilities

Move away from Bootstrap grid → adopt CSS Grid or Flexbox.

Step 4: Replace page-level components

Modals, alerts, navbars, dropdowns.

Step 5: Remove Bootstrap imports

Once all components are replaced, remove:

import "bootstrap/dist/css/bootstrap.css";

Avoid big-bang rewrites

Do not replace everything at once; migrate page by page or component by component.

5. Ensuring consistency during transition

a) Use a compatibility layer

Create wrapper classes so old components look similar to new ones.

b) Add Storybook

Document new components and test visual consistency.

c) Use automated visual regression testing

Tools: Percy, Chromatic.

d) Keep both systems running temporarily

Allow gradual adoption by running both Bootstrap and your custom styles until migration is complete.

Conclusion

Migrating from Bootstrap to a custom design system is one of the most impactful ways to modernize your UI. With a step-by-step strategy, you avoid breaking the interface while gaining full control over branding, accessibility, and performance.

By building design tokens, replacing components progressively, and ensuring consistency with strong documentation and testing, your new design system will grow into a scalable foundation for future products.

References & tools

Bootstrap Design systems Design tokens CSS refactoring Migration strategy React

Related articles

Elevate your digital experience

Whether you need a custom UI design, AI-powered solutions, or expert consulting, we are here to help you bring your ideas to life with precision, creativity, and the latest in AI technology.