Lab 15: Capstone — Design System

Time: 30 minutes | Level: Advanced | Docker: docker run -it --rm node:20-alpine sh

Overview

Build a complete, production-ready design system combining all Advanced skills: Style Dictionary tokens (JSON → CSS), Web Components (button/card/modal), PostCSS pipeline, dark/light/high-contrast themes, and axe-core WCAG 2.2 AA validation.


Step 1: Token Architecture (Style Dictionary)

// tokens/primitive.json
{
  "color": {
    "blue":  { "500": {"$value":"#3b82f6","$type":"color"}, "600": {"$value":"#2563eb","$type":"color"} },
    "gray":  { "50": {"$value":"#f9fafb","$type":"color"},  "900": {"$value":"#111827","$type":"color"} },
    "red":   { "500": {"$value":"#ef4444","$type":"color"} },
    "green": { "500": {"$value":"#22c55e","$type":"color"} }
  },
  "space": {
    "1": {"$value":"4px","$type":"dimension"},
    "2": {"$value":"8px","$type":"dimension"},
    "3": {"$value":"12px","$type":"dimension"},
    "4": {"$value":"16px","$type":"dimension"},
    "6": {"$value":"24px","$type":"dimension"},
    "8": {"$value":"32px","$type":"dimension"}
  },
  "radius": {
    "sm": {"$value":"4px","$type":"dimension"},
    "md": {"$value":"8px","$type":"dimension"},
    "lg": {"$value":"12px","$type":"dimension"}
  },
  "font-size": {
    "sm":  {"$value":"14px","$type":"dimension"},
    "md":  {"$value":"16px","$type":"dimension"},
    "lg":  {"$value":"20px","$type":"dimension"},
    "xl":  {"$value":"24px","$type":"dimension"},
    "2xl": {"$value":"32px","$type":"dimension"}
  }
}

Step 2: Web Component — <ds-button>


Step 3: Web Component — <ds-card>


Step 4: PostCSS Pipeline


Step 5: WCAG 2.2 AA Design System Checklist


Step 6: Theme Implementation


Step 7: Design System README

Components

Component
Tag
Variants

Button

<ds-button>

primary, secondary, danger

Card

<ds-card>

default

Modal

<ds-modal>

default

Theming

Token Usage

📸 Verified Output:


Summary — Full Design System Stack

Layer
Tool/Tech
Purpose

Tokens

JSON + Style Dictionary

Primitive → Semantic → Component

CSS

Custom Properties

Theming system

Build

PostCSS (preset-env + autoprefixer + cssnano)

Modern CSS → compatible + minified

Components

Web Components (Custom Elements + Shadow DOM)

Encapsulated, reusable

Theming

[data-theme] + CSS vars

Light / Dark / High-contrast

Accessibility

WCAG 2.2 AA + axe-core

All users

Testing

html-validate + axe audit

CI quality gate

i18n

Logical properties

RTL/LTR ready

Performance

contain: content + content-visibility

Fast rendering

Progressive

@supports + module/nomodule

All browsers

Last updated