Skip to main content
โšก Calmops

Design Systems: Building Consistent User Interfaces

Introduction

A design system is a collection of reusable components, guided by clear standards, that can be assembled to build any number of applications. Well-designed design systems improve consistency, speed up development, and create cohesive user experiences. This guide covers how to build and maintain effective design systems.

What Is a Design System?

Components

  • Design tokens: Colors, typography, spacing
  • Components: Reusable UI elements
  • Patterns: Common combinations of components
  • Guidelines: Usage documentation
  • Voice and tone: Content guidelines
  • Style guide: Visual standards only
  • Component library: UI components
  • Design system: Complete ecosystem

Design Tokens

Definition

Design tokens are the visual design atoms of a design system:

{
  "color": {
    "primary": {
      "value": "#0066CC",
      "description": "Primary brand color"
    },
    "secondary": {
      "value": "#F5F5F5",
      "description": "Background color"
    }
  },
  "spacing": {
    "small": { "value": "4px" },
    "medium": { "value": "8px" },
    "large": { "value": "16px" }
  },
  "font": {
    "family": { "value": "Inter, sans-serif" },
    "size": {
      "small": { "value": "12px" },
      "body": { "value": "14px" },
      "heading": { "value": "24px" }
    }
  }
}

Implementation

CSS Variables

:root {
  --color-primary: #0066CC;
  --color-secondary: #F5F5F5;
  --spacing-small: 4px;
  --spacing-medium: 8px;
  --font-family: Inter, sans-serif;
}

JavaScript

const tokens = {
  colors: {
    primary: '#0066CC',
    secondary: '#F5F5F5'
  },
  spacing: {
    small: '4px',
    medium: '8px'
  }
};

export default tokens;

Component Architecture

Atomic Design

Atoms

Basic building blocks:

  • Buttons
  • Inputs
  • Labels
  • Colors
  • Typography

Molecules

Simple component groups:

  • Search bar (input + button)
  • Form field (label + input + error)
  • Navigation item (icon + text)

Organisms

Complex UI sections:

  • Header
  • Card
  • Sidebar
  • Footer

Templates

Page layouts:

  • Blog post template
  • Dashboard template
  • Form page template

Pages

Complete implementations:

  • Home page
  • Profile page
  • Settings page

Component API

// Props for a Button component
const Button = ({
  variant: 'primary', // primary, secondary, ghost
  size: 'medium',     // small, medium, large
  disabled: false,
  loading: false,
  icon: null,
  children: '',
  onClick: () => {}
}) => {
  return (
    <button 
      className={`btn btn-${variant} btn-${size}`}
      disabled={disabled || loading}
      onClick={onClick}
    >
      {loading && <Spinner />}
      {icon && <Icon name={icon} />}
      {children}
    </button>
  );
};

Building a Component Library

Framework Options

  • React: Most popular, strong ecosystem
  • Vue: Growing adoption
  • Web Components: Framework-agnostic
  • Storybook: Development environment

Setup with React and Storybook

// Button.stories.jsx
import { Button } from './Button';

export default {
  title: 'Components/Button',
  component: Button,
  argTypes: {
    variant: {
      control: 'select',
      options: ['primary', 'secondary', 'ghost']
    },
    size: {
      control: 'select',
      options: ['small', 'medium', 'large']
    }
  }
};

export const Primary = {
  args: {
    variant: 'primary',
    children: 'Primary Button'
  }
};

export const Secondary = {
  args: {
    variant: 'secondary',
    children: 'Secondary Button'
  }
};

Documentation

/**
 * Primary button component for main actions.
 * 
 * ### When to use
 * - Submitting forms
 * - Confirming actions
 * - Primary navigation
 * 
 * ### When not to use
 * - Secondary actions (use Secondary)
 * - Destructive actions (use Danger)
 */
export const Button = ({ variant, children }) => {
  // Implementation
};

Accessibility

WCAG Guidelines

Follow WCAG 2.1 AA standards:

  • Perceivable: Text alternatives, adaptable, distinguishable
  • Operable: Keyboard accessible, enough time, seizure-free
  • Understandable: Readable, predictable, input assistance
  • Robust: Compatible with current and future tools

Implementation

// Accessible button with proper aria
<button
  aria-label="Close dialog"
  aria-describedby="dialog-description"
  onClick={handleClose}
>
  <Icon name="close" aria-hidden="true" />
</button>

// Form with proper labels
<label htmlFor="email">Email address</label>
<input
  id="email"
  type="email"
  aria-describedby="email-hint"
  aria-invalid={hasError}
/>
<span id="email-hint">We'll never share your email.</span>

Testing

  • Use axe for automated testing
  • Test with screen readers
  • Keyboard navigation testing
  • Color contrast checking

Versioning

Semantic Versioning

1.0.0 โ†’ 1.1.0 โ†’ 2.0.0
  • Patch: Bug fixes
  • Minor: New features (backward compatible)
  • Major: Breaking changes

Breaking Changes

Communicate clearly:

  • Migration guides
  • Deprecation warnings
  • Version-specific documentation
  • Changelog

Governance

Maintenance

  • Regular updates
  • Bug fixes
  • New components
  • Deprecated component handling

Contribution

  • Contribution guidelines
  • Review process
  • Design review
  • Code review

Adoption

  • Team onboarding
  • Training sessions
  • Support channels
  • Success metrics

Tools

Design Tools

  • Figma: Component design
  • Sketch: macOS design
  • Adobe XD: Prototyping
  • Framer: Design + code

Development Tools

  • Storybook: Component development
  • Style Dictionary: Token management
  • Lerna: Monorepo management
  • Changesets: Version management

Testing

  • Chromatic: Visual regression testing
  • Percy: Visual testing
  • Loki: Visual regression for React Native

Open Source

  • Material UI: React component library
  • Chakra UI: Simple, modular React components
  • Tailwind UI: Utility-first components
  • Radix UI: Unstyled, accessible primitives
  • Adobe Spectrum: Adobe’s design system

Company Systems

  • Shopify Polaris: E-commerce focused
  • Salesforce Lightning: Enterprise
  • Carbon Design System: IBM
  • Microsoft Fluent: Windows design

Building Your Own

Getting Started

  1. Audit existing design: Document current patterns
  2. Define design tokens: Colors, typography, spacing
  3. Build core components: Buttons, inputs, cards
  4. Create documentation: Usage guidelines
  5. Publish and adopt: Get teams using it

Common Mistakes

  • Building too much, too fast
  • Not involving developers
  • Poor documentation
  • No governance plan
  • Ignoring accessibility

Conclusion

Design systems are investments that pay dividends through consistency, speed, and quality. Start small, build incrementally, and focus on the components you actually need. The best design system is one that gets usedโ€”so make adoption easy and benefits clear.


Resources

Comments