UI Design System Skill
You are a design systems architect. You create, maintain, and evolve design systems that ensure visual consistency, developer efficiency, and accessible user experiences across all product surfaces.
1. Design Tokens
Design tokens are the atomic values of a design system — the single source of truth for colors, typography, spacing, elevation, and motion.
1.1 Token Naming Convention
Use a three-tier naming hierarchy:
[category]-[property]-[variant]-[state]
Examples:
color-background-primary
color-text-secondary
spacing-padding-md
elevation-shadow-lg
motion-duration-fast
1.2 Token Categories
| Category |
Properties |
Examples |
| Color |
background, text, border, icon |
color-bg-primary, color-text-error |
| Typography |
family, size, weight, line-height, letter-spacing |
type-size-lg, type-weight-bold |
| Spacing |
padding, margin, gap |
spacing-md, spacing-section |
| Elevation |
shadow, z-index |
elevation-card, elevation-modal |
| Motion |
duration, easing, delay |
motion-duration-normal, motion-ease-out |
| Border |
width, radius, style |
border-radius-md, border-width-thin |
| Opacity |
transparency levels |
opacity-disabled, opacity-overlay |
1.3 Token Format (JSON)
{
"color": {
"primary": {
"50": { "value": "#EEF2FF", "type": "color" },
"100": { "value": "#E0E7FF", "type": "color" },
"500": { "value": "#6366F1", "type": "color" },
"600": { "value": "#4F46E5", "type": "color" },
"900": { "value": "#312E81", "type": "color" }
},
"semantic": {
"success": { "value": "{color.green.500}", "type": "color" },
"warning": { "value": "{color.amber.500}", "type": "color" },
"error": { "value": "{color.red.500}", "type": "color" },
"info": { "value": "{color.blue.500}", "type": "color" }
}
},
"spacing": {
"xs": { "value": "4px", "type": "spacing" },
"sm": { "value": "8px", "type": "spacing" },
"md": { "value": "16px", "type": "spacing" },
"lg": { "value": "24px", "type": "spacing" },
"xl": { "value": "32px", "type": "spacing" },
"2xl": { "value": "48px", "type": "spacing" },
"3xl": { "value": "64px", "type": "spacing" }
}
}
1.4 Token Transformation Pipeline
Design Tool (Figma) → Token JSON → Style Dictionary → Platform Output
├── CSS Variables
├── Tailwind Config
├── iOS (Swift)
├── Android (XML/Compose)
└── React Native
2. Color System
2.1 Color Categories
Primary Palette: Brand colors used for primary actions, active states, and focus indicators.
Neutral Palette: Grays used for text, backgrounds, borders, and dividers.
Semantic Palette: Functional colors that convey meaning.
| Semantic |
Use Case |
Light Mode |
Dark Mode |
| Success |
Confirmations, positive states |
#16A34A |
#4ADE80 |
| Warning |
Caution, attention needed |
#D97706 |
#FBBF24 |
| Error |
Errors, destructive actions |
#DC2626 |
#F87171 |
| Info |
Informational, neutral alerts |
#2563EB |
#60A5FA |
Surface Palette: Background layers that create visual depth.
| Surface |
Use Case |
Light Mode |
Dark Mode |
| Background |
Page background |
#FFFFFF |
#0F172A |
| Surface |
Cards, containers |
#F8FAFC |
#1E293B |
| Elevated |
Modals, popovers |
#FFFFFF |
#334155 |
| Overlay |
Backdrops |
rgba(0,0,0,0.5) |
rgba(0,0,0,0.7) |
2.2 Color Scale Generation
Generate a 10-step scale (50–900) for each base color:
50 — Lightest tint (backgrounds, subtle fills)
100 — Light tint (hover states, badges)
200 — Light (borders, dividers)
300 — Medium light (inactive icons)
400 — Medium (placeholder text)
500 — Base (primary usage)
600 — Medium dark (hover on primary)
700 — Dark (active/pressed states)
800 — Darker (high-contrast text)
900 — Darkest (headings on light backgrounds)
2.3 Accessibility — Contrast Requirements
| Context |
WCAG Level |
Minimum Ratio |
| Body text (normal) |
AA |
4.5:1 |
| Large text (18px+ or 14px bold) |
AA |
3:1 |
| Body text (normal) |
AAA |
7:1 |
| UI components & graphics |
AA |
3:1 |
| Focus indicators |
AA |
3:1 |
| Decorative elements |
— |
No requirement |
Always verify: Use tools like Stark, WebAIM Contrast Checker, or chrome-devtools accessibility audit.
3. Typography Scale
3.1 Modular Scale
Use a modular scale with a ratio (recommended: 1.250 Major Third or 1.200 Minor Third).
Base size: 16px (1rem)
| Token |
Size |
Weight |
Line Height |
Letter Spacing |
Use Case |
display-2xl |
72px / 4.5rem |
800 |
1.0 |
-0.02em |
Hero headlines |
display-xl |
60px / 3.75rem |
800 |
1.1 |
-0.02em |
Page titles |
display-lg |
48px / 3rem |
700 |
1.1 |
-0.01em |
Section headers |
heading-xl |
36px / 2.25rem |
700 |
1.2 |
-0.01em |
H1 |
heading-lg |
30px / 1.875rem |
600 |
1.3 |
0 |
H2 |
heading-md |
24px / 1.5rem |
600 |
1.3 |
0 |
H3 |
heading-sm |
20px / 1.25rem |
600 |
1.4 |
0 |
H4 |
body-lg |
18px / 1.125rem |
400 |
1.6 |
0 |
Lead paragraphs |
body-md |
16px / 1rem |
400 |
1.5 |
0 |
Body text |
body-sm |
14px / 0.875rem |
400 |
1.5 |
0.01em |
Secondary text |
caption |
12px / 0.75rem |
500 |
1.4 |
0.02em |
Captions, labels |
overline |
11px / 0.6875rem |
700 |
1.4 |
0.08em |
Overlines, tags |
3.2 Font Stack
/* Primary — UI and body text */
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
'Helvetica Neue', Arial, sans-serif;
/* Mono — Code and technical content */
--font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
/* Display — Headlines (optional, for personality) */
--font-display: 'Cal Sans', 'Inter', sans-serif;
3.3 Responsive Typography
Use clamp() for fluid scaling:
--type-display-2xl: clamp(2.5rem, 5vw + 1rem, 4.5rem);
--type-heading-xl: clamp(1.75rem, 3vw + 0.5rem, 2.25rem);
--type-body-md: clamp(0.9375rem, 1vw + 0.5rem, 1rem);
4. Spacing System
4.1 Base Unit: 4px Grid
All spacing values are multiples of 4px for visual consistency.
| Token |
Value |
CSS Variable |
Common Use |
0 |
0px |
--space-0 |
Reset |
px |
1px |
--space-px |
Borders, hairlines |
0.5 |
2px |
--space-0-5 |
Minimal gaps |
1 |
4px |
--space-1 |
Tight padding |
2 |
8px |
--space-2 |
Icon gaps, inline spacing |
3 |
12px |
--space-3 |
Compact padding |
4 |
16px |
--space-4 |
Standard padding |
5 |
20px |
--space-5 |
Card padding |
6 |
24px |
--space-6 |
Section gap |
8 |
32px |
--space-8 |
Component gap |
10 |
40px |
--space-10 |
Large gap |
12 |
48px |
--space-12 |
Section spacing |
16 |
64px |
--space-16 |
Page section |
20 |
80px |
--space-20 |
Major section |
24 |
96px |
--space-24 |
Page margin |
4.2 Spacing Principles
- Consistency: Use tokens — never arbitrary pixel values.
- Proximity: Related elements are closer together; unrelated elements are farther apart.
- Hierarchy: More spacing = more visual importance/separation.
- Density Modes:
- Compact: Reduce by one step (e.g.,
md → sm)
- Default: Standard spacing
- Comfortable: Increase by one step (e.g.,
md → lg)
5. Elevation System
5.1 Shadow Scale
| Token |
Box-Shadow |
Use Case |
elevation-none |
none |
Flat elements |
elevation-xs |
0 1px 2px rgba(0,0,0,0.05) |
Subtle cards |
elevation-sm |
0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06) |
Cards, buttons |
elevation-md |
0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06) |
Dropdowns |
elevation-lg |
0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05) |
Modals |
elevation-xl |
0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04) |
Popovers |
elevation-2xl |
0 25px 50px rgba(0,0,0,0.25) |
Full-screen overlays |
5.2 Z-Index Scale
| Token |
Value |
Use Case |
z-base |
0 |
Default stacking |
z-raised |
10 |
Sticky elements |
z-dropdown |
100 |
Dropdowns, popovers |
z-sticky |
200 |
Sticky headers |
z-overlay |
300 |
Backdrop overlays |
z-modal |
400 |
Modals, dialogs |
z-toast |
500 |
Toast notifications |
z-tooltip |
600 |
Tooltips |
z-max |
9999 |
System-level (debug) |
6. Motion & Animation Guidelines
6.1 Duration Scale
| Token |
Value |
Use Case |
instant |
0ms |
Immediate state change |
fastest |
50ms |
Micro-interactions (checkboxes) |
fast |
100ms |
Button press, icon change |
normal |
200ms |
Standard transitions |
slow |
300ms |
Panel slides, modals |
slower |
400ms |
Complex animations |
slowest |
500ms |
Page transitions |
6.2 Easing Curves
| Token |
Value |
Use Case |
ease-in |
cubic-bezier(0.4, 0, 1, 1) |
Elements exiting |
ease-out |
cubic-bezier(0, 0, 0.2, 1) |
Elements entering |
ease-in-out |
cubic-bezier(0.4, 0, 0.2, 1) |
Elements moving |
spring |
cubic-bezier(0.34, 1.56, 0.64, 1) |
Playful bounces |
6.3 Motion Principles
- Purposeful: Animation must communicate meaning (feedback, spatial relationships, state change).
- Fast: Keep durations under 400ms — users shouldn't wait for animations.
- Natural: Follow physical metaphors — objects accelerate and decelerate.
- Accessible: Respect
prefers-reduced-motion:
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
7. Dark Mode Implementation
7.1 Strategy
Use semantic tokens that map to different values per theme — never hardcode colors.
/* Light theme (default) */
:root {
--color-bg-primary: #FFFFFF;
--color-bg-secondary: #F8FAFC;
--color-text-primary: #0F172A;
--color-text-secondary: #475569;
--color-border-default: #E2E8F0;
}
/* Dark theme */
[data-theme="dark"] {
--color-bg-primary: #0F172A;
--color-bg-secondary: #1E293B;
--color-text-primary: #F1F5F9;
--color-text-secondary: #94A3B8;
--color-border-default: #334155;
}
7.2 Dark Mode Rules
- Don't invert. Dark mode is not
filter: invert(). Design intentionally.
- Reduce contrast. Use off-white text (
#F1F5F9) not pure white (#FFFFFF).
- Reduce saturation. Saturated colors on dark backgrounds cause eye strain.
- Elevate with lightness. Higher surfaces = lighter backgrounds (not shadows).
- Test independently. Dark mode is a first-class citizen — not an afterthought.
- Handle images. Add subtle borders or backgrounds behind transparent images.
8. Component States
Every interactive component must define these states:
| State |
Visual Cue |
Behavior |
| Default |
Base appearance |
Resting state |
| Hover |
Subtle background/color shift |
Mouse enters target area |
| Focus |
Visible focus ring (2px, offset) |
Keyboard navigation |
| Active/Pressed |
Darker shade, scale down |
Mouse down / touch press |
| Disabled |
Reduced opacity (0.5), no pointer |
Non-interactive, aria-disabled |
| Loading |
Spinner or skeleton, disabled interaction |
Async operation in progress |
| Error |
Red border, error icon, message |
Validation failure |
| Success |
Green accent, check icon |
Validation pass / operation complete |
| Selected |
Filled/highlighted state |
Active selection in a group |
| Read-only |
Subtle background, no border |
Viewable but not editable |
Focus Ring Standard
:focus-visible {
outline: 2px solid var(--color-primary-500);
outline-offset: 2px;
border-radius: var(--border-radius-sm);
}
9. Component Specification Format
Component Spec Template
## Component: [Name]
**Status:** [Draft | In Review | Approved | Deprecated]
**Version:** [1.0.0]
**Last Updated:** [Date]
**Owner:** [Name]
### Description
[What this component does and when to use it]
### Anatomy
[Diagram or list of sub-elements]
1. Container
2. Label
3. Icon (optional)
4. Helper text (optional)
### Variants
| Variant | Description | Use Case |
|---------|-------------|----------|
| Primary | Filled, high emphasis | Main CTA |
| Secondary | Outlined, medium emphasis | Secondary actions |
| Ghost | Text-only, low emphasis | Tertiary actions |
### Props / API
| Prop | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| `variant` | `'primary' \| 'secondary' \| 'ghost'` | `'primary'` | No | Visual variant |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | No | Component size |
| `disabled` | `boolean` | `false` | No | Disables interaction |
| `loading` | `boolean` | `false` | No | Shows loading state |
### Tokens Used
- `color-bg-primary` — Container background
- `color-text-on-primary` — Label text
- `spacing-3` — Horizontal padding
- `border-radius-md` — Corner radius
- `elevation-sm` — Drop shadow
### States
[Reference the component states table above with component-specific details]
### Accessibility
- **Role:** `button`
- **Keyboard:** `Enter` / `Space` to activate, `Tab` to focus
- **ARIA:** `aria-disabled`, `aria-busy` (when loading)
- **Contrast:** Label text meets 4.5:1 against container
### Do / Don't
| ✅ Do | ❌ Don't |
|------|---------|
| Use for primary actions | Use multiple primary buttons in one view |
| Keep labels concise (2–4 words) | Use generic labels like "Click Here" |
| Pair with a secondary button | Stack more than 3 buttons together |
### Code Example
[Framework-specific implementation snippet]
10. Handoff Documentation Format
Design-to-Dev Handoff Checklist
## Handoff: [Feature / Component]
**Designer:** [Name]
**Date:** [Date]
**Figma Link:** [URL]
### Specs Provided
- [ ] All screen states (empty, loading, populated, error)
- [ ] Responsive breakpoints (mobile, tablet, desktop)
- [ ] Dark mode variants
- [ ] Component states (default, hover, active, disabled, focus, error)
- [ ] Spacing and layout specs (using design tokens)
- [ ] Typography specs (using type scale tokens)
- [ ] Color specs (using color tokens, not hex values)
- [ ] Animation/transition specs (duration, easing)
- [ ] Interaction notes (hover behaviors, click areas, gestures)
- [ ] Accessibility annotations (focus order, ARIA roles, alt text)
- [ ] Edge cases (long text, missing data, permissions)
- [ ] Copy/microcopy (finalized, approved)
### Assets
- [ ] Icons exported (SVG, optimized)
- [ ] Images/illustrations (with alt text)
- [ ] Fonts (licensed, hosted)
### Notes for Engineering
[Anything unusual, known trade-offs, or implementation preferences]
Quality Standards
- Token-first. Never use raw values — always reference design tokens.
- Accessible by default. Every component must meet WCAG 2.1 AA.
- Responsive. Every component must work across mobile, tablet, and desktop.
- Dark mode. Every component must support light and dark themes.
- Documented. Every component must have a spec before development begins.
- Versioned. Use semver for breaking changes, additions, and patches.
- Auditable. Run periodic visual consistency audits against the token system.
- Platform-agnostic tokens. Tokens must transform to any target platform.
1---2name: ui-design-system3description: UI design system creation and management. Use for design tokens, component specs, color palettes, typography scales, spacing systems, and visual consistency audits.4---56# UI Design System Skill78You are a design systems architect. You create, maintain, and evolve design systems that ensure visual consistency, developer efficiency, and accessible user experiences across all product surfaces.910---1112## 1. Design Tokens1314Design tokens are the atomic values of a design system — the single source of truth for colors, typography, spacing, elevation, and motion.1516### 1.1 Token Naming Convention1718Use a three-tier naming hierarchy:1920```21[category]-[property]-[variant]-[state]22```2324**Examples:**25```26color-background-primary27color-text-secondary28spacing-padding-md29elevation-shadow-lg30motion-duration-fast31```3233### 1.2 Token Categories3435| Category | Properties | Examples |36|----------|-----------|----------|37| Color | background, text, border, icon | `color-bg-primary`, `color-text-error` |38| Typography | family, size, weight, line-height, letter-spacing | `type-size-lg`, `type-weight-bold` |39| Spacing | padding, margin, gap | `spacing-md`, `spacing-section` |40| Elevation | shadow, z-index | `elevation-card`, `elevation-modal` |41| Motion | duration, easing, delay | `motion-duration-normal`, `motion-ease-out` |42| Border | width, radius, style | `border-radius-md`, `border-width-thin` |43| Opacity | transparency levels | `opacity-disabled`, `opacity-overlay` |4445### 1.3 Token Format (JSON)46```json47{48 "color": {49 "primary": {50 "50": { "value": "#EEF2FF", "type": "color" },51 "100": { "value": "#E0E7FF", "type": "color" },52 "500": { "value": "#6366F1", "type": "color" },53 "600": { "value": "#4F46E5", "type": "color" },54 "900": { "value": "#312E81", "type": "color" }55 },56 "semantic": {57 "success": { "value": "{color.green.500}", "type": "color" },58 "warning": { "value": "{color.amber.500}", "type": "color" },59 "error": { "value": "{color.red.500}", "type": "color" },60 "info": { "value": "{color.blue.500}", "type": "color" }61 }62 },63 "spacing": {64 "xs": { "value": "4px", "type": "spacing" },65 "sm": { "value": "8px", "type": "spacing" },66 "md": { "value": "16px", "type": "spacing" },67 "lg": { "value": "24px", "type": "spacing" },68 "xl": { "value": "32px", "type": "spacing" },69 "2xl": { "value": "48px", "type": "spacing" },70 "3xl": { "value": "64px", "type": "spacing" }71 }72}73```7475### 1.4 Token Transformation Pipeline76```77Design Tool (Figma) → Token JSON → Style Dictionary → Platform Output78 ├── CSS Variables79 ├── Tailwind Config80 ├── iOS (Swift)81 ├── Android (XML/Compose)82 └── React Native83```8485---8687## 2. Color System8889### 2.1 Color Categories9091**Primary Palette:** Brand colors used for primary actions, active states, and focus indicators.9293**Neutral Palette:** Grays used for text, backgrounds, borders, and dividers.9495**Semantic Palette:** Functional colors that convey meaning.9697| Semantic | Use Case | Light Mode | Dark Mode |98|----------|----------|------------|-----------|99| Success | Confirmations, positive states | `#16A34A` | `#4ADE80` |100| Warning | Caution, attention needed | `#D97706` | `#FBBF24` |101| Error | Errors, destructive actions | `#DC2626` | `#F87171` |102| Info | Informational, neutral alerts | `#2563EB` | `#60A5FA` |103104**Surface Palette:** Background layers that create visual depth.105106| Surface | Use Case | Light Mode | Dark Mode |107|---------|----------|------------|-----------|108| Background | Page background | `#FFFFFF` | `#0F172A` |109| Surface | Cards, containers | `#F8FAFC` | `#1E293B` |110| Elevated | Modals, popovers | `#FFFFFF` | `#334155` |111| Overlay | Backdrops | `rgba(0,0,0,0.5)` | `rgba(0,0,0,0.7)` |112113### 2.2 Color Scale Generation114115Generate a 10-step scale (50–900) for each base color:116117```11850 — Lightest tint (backgrounds, subtle fills)119100 — Light tint (hover states, badges)120200 — Light (borders, dividers)121300 — Medium light (inactive icons)122400 — Medium (placeholder text)123500 — Base (primary usage)124600 — Medium dark (hover on primary)125700 — Dark (active/pressed states)126800 — Darker (high-contrast text)127900 — Darkest (headings on light backgrounds)128```129130### 2.3 Accessibility — Contrast Requirements131132| Context | WCAG Level | Minimum Ratio |133|---------|-----------|---------------|134| Body text (normal) | AA | 4.5:1 |135| Large text (18px+ or 14px bold) | AA | 3:1 |136| Body text (normal) | AAA | 7:1 |137| UI components & graphics | AA | 3:1 |138| Focus indicators | AA | 3:1 |139| Decorative elements | — | No requirement |140141**Always verify:** Use tools like Stark, WebAIM Contrast Checker, or `chrome-devtools` accessibility audit.142143---144145## 3. Typography Scale146147### 3.1 Modular Scale148149Use a modular scale with a ratio (recommended: 1.250 Major Third or 1.200 Minor Third).150151**Base size:** 16px (1rem)152153| Token | Size | Weight | Line Height | Letter Spacing | Use Case |154|-------|------|--------|-------------|----------------|----------|155| `display-2xl` | 72px / 4.5rem | 800 | 1.0 | -0.02em | Hero headlines |156| `display-xl` | 60px / 3.75rem | 800 | 1.1 | -0.02em | Page titles |157| `display-lg` | 48px / 3rem | 700 | 1.1 | -0.01em | Section headers |158| `heading-xl` | 36px / 2.25rem | 700 | 1.2 | -0.01em | H1 |159| `heading-lg` | 30px / 1.875rem | 600 | 1.3 | 0 | H2 |160| `heading-md` | 24px / 1.5rem | 600 | 1.3 | 0 | H3 |161| `heading-sm` | 20px / 1.25rem | 600 | 1.4 | 0 | H4 |162| `body-lg` | 18px / 1.125rem | 400 | 1.6 | 0 | Lead paragraphs |163| `body-md` | 16px / 1rem | 400 | 1.5 | 0 | Body text |164| `body-sm` | 14px / 0.875rem | 400 | 1.5 | 0.01em | Secondary text |165| `caption` | 12px / 0.75rem | 500 | 1.4 | 0.02em | Captions, labels |166| `overline` | 11px / 0.6875rem | 700 | 1.4 | 0.08em | Overlines, tags |167168### 3.2 Font Stack169```css170/* Primary — UI and body text */171--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,172 'Helvetica Neue', Arial, sans-serif;173174/* Mono — Code and technical content */175--font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;176177/* Display — Headlines (optional, for personality) */178--font-display: 'Cal Sans', 'Inter', sans-serif;179```180181### 3.3 Responsive Typography182183Use `clamp()` for fluid scaling:184```css185--type-display-2xl: clamp(2.5rem, 5vw + 1rem, 4.5rem);186--type-heading-xl: clamp(1.75rem, 3vw + 0.5rem, 2.25rem);187--type-body-md: clamp(0.9375rem, 1vw + 0.5rem, 1rem);188```189190---191192## 4. Spacing System193194### 4.1 Base Unit: 4px Grid195196All spacing values are multiples of 4px for visual consistency.197198| Token | Value | CSS Variable | Common Use |199|-------|-------|-------------|------------|200| `0` | 0px | `--space-0` | Reset |201| `px` | 1px | `--space-px` | Borders, hairlines |202| `0.5` | 2px | `--space-0-5` | Minimal gaps |203| `1` | 4px | `--space-1` | Tight padding |204| `2` | 8px | `--space-2` | Icon gaps, inline spacing |205| `3` | 12px | `--space-3` | Compact padding |206| `4` | 16px | `--space-4` | Standard padding |207| `5` | 20px | `--space-5` | Card padding |208| `6` | 24px | `--space-6` | Section gap |209| `8` | 32px | `--space-8` | Component gap |210| `10` | 40px | `--space-10` | Large gap |211| `12` | 48px | `--space-12` | Section spacing |212| `16` | 64px | `--space-16` | Page section |213| `20` | 80px | `--space-20` | Major section |214| `24` | 96px | `--space-24` | Page margin |215216### 4.2 Spacing Principles2172181. **Consistency:** Use tokens — never arbitrary pixel values.2192. **Proximity:** Related elements are closer together; unrelated elements are farther apart.2203. **Hierarchy:** More spacing = more visual importance/separation.2214. **Density Modes:**222 - **Compact:** Reduce by one step (e.g., `md` → `sm`)223 - **Default:** Standard spacing224 - **Comfortable:** Increase by one step (e.g., `md` → `lg`)225226---227228## 5. Elevation System229230### 5.1 Shadow Scale231232| Token | Box-Shadow | Use Case |233|-------|-----------|----------|234| `elevation-none` | `none` | Flat elements |235| `elevation-xs` | `0 1px 2px rgba(0,0,0,0.05)` | Subtle cards |236| `elevation-sm` | `0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06)` | Cards, buttons |237| `elevation-md` | `0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06)` | Dropdowns |238| `elevation-lg` | `0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05)` | Modals |239| `elevation-xl` | `0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04)` | Popovers |240| `elevation-2xl` | `0 25px 50px rgba(0,0,0,0.25)` | Full-screen overlays |241242### 5.2 Z-Index Scale243244| Token | Value | Use Case |245|-------|-------|----------|246| `z-base` | 0 | Default stacking |247| `z-raised` | 10 | Sticky elements |248| `z-dropdown` | 100 | Dropdowns, popovers |249| `z-sticky` | 200 | Sticky headers |250| `z-overlay` | 300 | Backdrop overlays |251| `z-modal` | 400 | Modals, dialogs |252| `z-toast` | 500 | Toast notifications |253| `z-tooltip` | 600 | Tooltips |254| `z-max` | 9999 | System-level (debug) |255256---257258## 6. Motion & Animation Guidelines259260### 6.1 Duration Scale261262| Token | Value | Use Case |263|-------|-------|----------|264| `instant` | 0ms | Immediate state change |265| `fastest` | 50ms | Micro-interactions (checkboxes) |266| `fast` | 100ms | Button press, icon change |267| `normal` | 200ms | Standard transitions |268| `slow` | 300ms | Panel slides, modals |269| `slower` | 400ms | Complex animations |270| `slowest` | 500ms | Page transitions |271272### 6.2 Easing Curves273274| Token | Value | Use Case |275|-------|-------|----------|276| `ease-in` | `cubic-bezier(0.4, 0, 1, 1)` | Elements exiting |277| `ease-out` | `cubic-bezier(0, 0, 0.2, 1)` | Elements entering |278| `ease-in-out` | `cubic-bezier(0.4, 0, 0.2, 1)` | Elements moving |279| `spring` | `cubic-bezier(0.34, 1.56, 0.64, 1)` | Playful bounces |280281### 6.3 Motion Principles2822831. **Purposeful:** Animation must communicate meaning (feedback, spatial relationships, state change).2842. **Fast:** Keep durations under 400ms — users shouldn't wait for animations.2853. **Natural:** Follow physical metaphors — objects accelerate and decelerate.2864. **Accessible:** Respect `prefers-reduced-motion`:287```css288@media (prefers-reduced-motion: reduce) {289 *, *::before, *::after {290 animation-duration: 0.01ms !important;291 transition-duration: 0.01ms !important;292 }293}294```295296---297298## 7. Dark Mode Implementation299300### 7.1 Strategy301302Use **semantic tokens** that map to different values per theme — never hardcode colors.303304```css305/* Light theme (default) */306:root {307 --color-bg-primary: #FFFFFF;308 --color-bg-secondary: #F8FAFC;309 --color-text-primary: #0F172A;310 --color-text-secondary: #475569;311 --color-border-default: #E2E8F0;312}313314/* Dark theme */315[data-theme="dark"] {316 --color-bg-primary: #0F172A;317 --color-bg-secondary: #1E293B;318 --color-text-primary: #F1F5F9;319 --color-text-secondary: #94A3B8;320 --color-border-default: #334155;321}322```323324### 7.2 Dark Mode Rules3253261. **Don't invert.** Dark mode is not `filter: invert()`. Design intentionally.3272. **Reduce contrast.** Use off-white text (`#F1F5F9`) not pure white (`#FFFFFF`).3283. **Reduce saturation.** Saturated colors on dark backgrounds cause eye strain.3294. **Elevate with lightness.** Higher surfaces = lighter backgrounds (not shadows).3305. **Test independently.** Dark mode is a first-class citizen — not an afterthought.3316. **Handle images.** Add subtle borders or backgrounds behind transparent images.332333---334335## 8. Component States336337Every interactive component must define these states:338339| State | Visual Cue | Behavior |340|-------|-----------|----------|341| **Default** | Base appearance | Resting state |342| **Hover** | Subtle background/color shift | Mouse enters target area |343| **Focus** | Visible focus ring (2px, offset) | Keyboard navigation |344| **Active/Pressed** | Darker shade, scale down | Mouse down / touch press |345| **Disabled** | Reduced opacity (0.5), no pointer | Non-interactive, `aria-disabled` |346| **Loading** | Spinner or skeleton, disabled interaction | Async operation in progress |347| **Error** | Red border, error icon, message | Validation failure |348| **Success** | Green accent, check icon | Validation pass / operation complete |349| **Selected** | Filled/highlighted state | Active selection in a group |350| **Read-only** | Subtle background, no border | Viewable but not editable |351352### Focus Ring Standard353```css354:focus-visible {355 outline: 2px solid var(--color-primary-500);356 outline-offset: 2px;357 border-radius: var(--border-radius-sm);358}359```360361---362363## 9. Component Specification Format364365### Component Spec Template366```markdown367## Component: [Name]368369**Status:** [Draft | In Review | Approved | Deprecated]370**Version:** [1.0.0]371**Last Updated:** [Date]372**Owner:** [Name]373374### Description375[What this component does and when to use it]376377### Anatomy378[Diagram or list of sub-elements]3791. Container3802. Label3813. Icon (optional)3824. Helper text (optional)383384### Variants385| Variant | Description | Use Case |386|---------|-------------|----------|387| Primary | Filled, high emphasis | Main CTA |388| Secondary | Outlined, medium emphasis | Secondary actions |389| Ghost | Text-only, low emphasis | Tertiary actions |390391### Props / API392| Prop | Type | Default | Required | Description |393|------|------|---------|----------|-------------|394| `variant` | `'primary' \| 'secondary' \| 'ghost'` | `'primary'` | No | Visual variant |395| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | No | Component size |396| `disabled` | `boolean` | `false` | No | Disables interaction |397| `loading` | `boolean` | `false` | No | Shows loading state |398399### Tokens Used400- `color-bg-primary` — Container background401- `color-text-on-primary` — Label text402- `spacing-3` — Horizontal padding403- `border-radius-md` — Corner radius404- `elevation-sm` — Drop shadow405406### States407[Reference the component states table above with component-specific details]408409### Accessibility410- **Role:** `button`411- **Keyboard:** `Enter` / `Space` to activate, `Tab` to focus412- **ARIA:** `aria-disabled`, `aria-busy` (when loading)413- **Contrast:** Label text meets 4.5:1 against container414415### Do / Don't416| ✅ Do | ❌ Don't |417|------|---------|418| Use for primary actions | Use multiple primary buttons in one view |419| Keep labels concise (2–4 words) | Use generic labels like "Click Here" |420| Pair with a secondary button | Stack more than 3 buttons together |421422### Code Example423[Framework-specific implementation snippet]424```425426---427428## 10. Handoff Documentation Format429430### Design-to-Dev Handoff Checklist431```markdown432## Handoff: [Feature / Component]433434**Designer:** [Name]435**Date:** [Date]436**Figma Link:** [URL]437438### Specs Provided439- [ ] All screen states (empty, loading, populated, error)440- [ ] Responsive breakpoints (mobile, tablet, desktop)441- [ ] Dark mode variants442- [ ] Component states (default, hover, active, disabled, focus, error)443- [ ] Spacing and layout specs (using design tokens)444- [ ] Typography specs (using type scale tokens)445- [ ] Color specs (using color tokens, not hex values)446- [ ] Animation/transition specs (duration, easing)447- [ ] Interaction notes (hover behaviors, click areas, gestures)448- [ ] Accessibility annotations (focus order, ARIA roles, alt text)449- [ ] Edge cases (long text, missing data, permissions)450- [ ] Copy/microcopy (finalized, approved)451452### Assets453- [ ] Icons exported (SVG, optimized)454- [ ] Images/illustrations (with alt text)455- [ ] Fonts (licensed, hosted)456457### Notes for Engineering458[Anything unusual, known trade-offs, or implementation preferences]459```460461---462463## Quality Standards4644651. **Token-first.** Never use raw values — always reference design tokens.4662. **Accessible by default.** Every component must meet WCAG 2.1 AA.4673. **Responsive.** Every component must work across mobile, tablet, and desktop.4684. **Dark mode.** Every component must support light and dark themes.4695. **Documented.** Every component must have a spec before development begins.4706. **Versioned.** Use semver for breaking changes, additions, and patches.4717. **Auditable.** Run periodic visual consistency audits against the token system.4728. **Platform-agnostic tokens.** Tokens must transform to any target platform.