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: >4 UI design system creation and management. Use for design tokens, component5 specs, color palettes, typography scales, spacing systems, and visual6 consistency audits.7---89# UI Design System Skill1011You 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.1213---1415## 1. Design Tokens1617Design tokens are the atomic values of a design system — the single source of truth for colors, typography, spacing, elevation, and motion.1819### 1.1 Token Naming Convention2021Use a three-tier naming hierarchy:2223```24[category]-[property]-[variant]-[state]25```2627**Examples:**28```29color-background-primary30color-text-secondary31spacing-padding-md32elevation-shadow-lg33motion-duration-fast34```3536### 1.2 Token Categories3738| Category | Properties | Examples |39|----------|-----------|----------|40| Color | background, text, border, icon | `color-bg-primary`, `color-text-error` |41| Typography | family, size, weight, line-height, letter-spacing | `type-size-lg`, `type-weight-bold` |42| Spacing | padding, margin, gap | `spacing-md`, `spacing-section` |43| Elevation | shadow, z-index | `elevation-card`, `elevation-modal` |44| Motion | duration, easing, delay | `motion-duration-normal`, `motion-ease-out` |45| Border | width, radius, style | `border-radius-md`, `border-width-thin` |46| Opacity | transparency levels | `opacity-disabled`, `opacity-overlay` |4748### 1.3 Token Format (JSON)49```json50{51 "color": {52 "primary": {53 "50": { "value": "#EEF2FF", "type": "color" },54 "100": { "value": "#E0E7FF", "type": "color" },55 "500": { "value": "#6366F1", "type": "color" },56 "600": { "value": "#4F46E5", "type": "color" },57 "900": { "value": "#312E81", "type": "color" }58 },59 "semantic": {60 "success": { "value": "{color.green.500}", "type": "color" },61 "warning": { "value": "{color.amber.500}", "type": "color" },62 "error": { "value": "{color.red.500}", "type": "color" },63 "info": { "value": "{color.blue.500}", "type": "color" }64 }65 },66 "spacing": {67 "xs": { "value": "4px", "type": "spacing" },68 "sm": { "value": "8px", "type": "spacing" },69 "md": { "value": "16px", "type": "spacing" },70 "lg": { "value": "24px", "type": "spacing" },71 "xl": { "value": "32px", "type": "spacing" },72 "2xl": { "value": "48px", "type": "spacing" },73 "3xl": { "value": "64px", "type": "spacing" }74 }75}76```7778### 1.4 Token Transformation Pipeline79```80Design Tool (Figma) → Token JSON → Style Dictionary → Platform Output81 ├── CSS Variables82 ├── Tailwind Config83 ├── iOS (Swift)84 ├── Android (XML/Compose)85 └── React Native86```8788---8990## 2. Color System9192### 2.1 Color Categories9394**Primary Palette:** Brand colors used for primary actions, active states, and focus indicators.9596**Neutral Palette:** Grays used for text, backgrounds, borders, and dividers.9798**Semantic Palette:** Functional colors that convey meaning.99100| Semantic | Use Case | Light Mode | Dark Mode |101|----------|----------|------------|-----------|102| Success | Confirmations, positive states | `#16A34A` | `#4ADE80` |103| Warning | Caution, attention needed | `#D97706` | `#FBBF24` |104| Error | Errors, destructive actions | `#DC2626` | `#F87171` |105| Info | Informational, neutral alerts | `#2563EB` | `#60A5FA` |106107**Surface Palette:** Background layers that create visual depth.108109| Surface | Use Case | Light Mode | Dark Mode |110|---------|----------|------------|-----------|111| Background | Page background | `#FFFFFF` | `#0F172A` |112| Surface | Cards, containers | `#F8FAFC` | `#1E293B` |113| Elevated | Modals, popovers | `#FFFFFF` | `#334155` |114| Overlay | Backdrops | `rgba(0,0,0,0.5)` | `rgba(0,0,0,0.7)` |115116### 2.2 Color Scale Generation117118Generate a 10-step scale (50–900) for each base color:119120```12150 — Lightest tint (backgrounds, subtle fills)122100 — Light tint (hover states, badges)123200 — Light (borders, dividers)124300 — Medium light (inactive icons)125400 — Medium (placeholder text)126500 — Base (primary usage)127600 — Medium dark (hover on primary)128700 — Dark (active/pressed states)129800 — Darker (high-contrast text)130900 — Darkest (headings on light backgrounds)131```132133### 2.3 Accessibility — Contrast Requirements134135| Context | WCAG Level | Minimum Ratio |136|---------|-----------|---------------|137| Body text (normal) | AA | 4.5:1 |138| Large text (18px+ or 14px bold) | AA | 3:1 |139| Body text (normal) | AAA | 7:1 |140| UI components & graphics | AA | 3:1 |141| Focus indicators | AA | 3:1 |142| Decorative elements | — | No requirement |143144**Always verify:** Use tools like Stark, WebAIM Contrast Checker, or `chrome-devtools` accessibility audit.145146---147148## 3. Typography Scale149150### 3.1 Modular Scale151152Use a modular scale with a ratio (recommended: 1.250 Major Third or 1.200 Minor Third).153154**Base size:** 16px (1rem)155156| Token | Size | Weight | Line Height | Letter Spacing | Use Case |157|-------|------|--------|-------------|----------------|----------|158| `display-2xl` | 72px / 4.5rem | 800 | 1.0 | -0.02em | Hero headlines |159| `display-xl` | 60px / 3.75rem | 800 | 1.1 | -0.02em | Page titles |160| `display-lg` | 48px / 3rem | 700 | 1.1 | -0.01em | Section headers |161| `heading-xl` | 36px / 2.25rem | 700 | 1.2 | -0.01em | H1 |162| `heading-lg` | 30px / 1.875rem | 600 | 1.3 | 0 | H2 |163| `heading-md` | 24px / 1.5rem | 600 | 1.3 | 0 | H3 |164| `heading-sm` | 20px / 1.25rem | 600 | 1.4 | 0 | H4 |165| `body-lg` | 18px / 1.125rem | 400 | 1.6 | 0 | Lead paragraphs |166| `body-md` | 16px / 1rem | 400 | 1.5 | 0 | Body text |167| `body-sm` | 14px / 0.875rem | 400 | 1.5 | 0.01em | Secondary text |168| `caption` | 12px / 0.75rem | 500 | 1.4 | 0.02em | Captions, labels |169| `overline` | 11px / 0.6875rem | 700 | 1.4 | 0.08em | Overlines, tags |170171### 3.2 Font Stack172```css173/* Primary — UI and body text */174--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,175 'Helvetica Neue', Arial, sans-serif;176177/* Mono — Code and technical content */178--font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;179180/* Display — Headlines (optional, for personality) */181--font-display: 'Cal Sans', 'Inter', sans-serif;182```183184### 3.3 Responsive Typography185186Use `clamp()` for fluid scaling:187```css188--type-display-2xl: clamp(2.5rem, 5vw + 1rem, 4.5rem);189--type-heading-xl: clamp(1.75rem, 3vw + 0.5rem, 2.25rem);190--type-body-md: clamp(0.9375rem, 1vw + 0.5rem, 1rem);191```192193---194195## 4. Spacing System196197### 4.1 Base Unit: 4px Grid198199All spacing values are multiples of 4px for visual consistency.200201| Token | Value | CSS Variable | Common Use |202|-------|-------|-------------|------------|203| `0` | 0px | `--space-0` | Reset |204| `px` | 1px | `--space-px` | Borders, hairlines |205| `0.5` | 2px | `--space-0-5` | Minimal gaps |206| `1` | 4px | `--space-1` | Tight padding |207| `2` | 8px | `--space-2` | Icon gaps, inline spacing |208| `3` | 12px | `--space-3` | Compact padding |209| `4` | 16px | `--space-4` | Standard padding |210| `5` | 20px | `--space-5` | Card padding |211| `6` | 24px | `--space-6` | Section gap |212| `8` | 32px | `--space-8` | Component gap |213| `10` | 40px | `--space-10` | Large gap |214| `12` | 48px | `--space-12` | Section spacing |215| `16` | 64px | `--space-16` | Page section |216| `20` | 80px | `--space-20` | Major section |217| `24` | 96px | `--space-24` | Page margin |218219### 4.2 Spacing Principles2202211. **Consistency:** Use tokens — never arbitrary pixel values.2222. **Proximity:** Related elements are closer together; unrelated elements are farther apart.2233. **Hierarchy:** More spacing = more visual importance/separation.2244. **Density Modes:**225 - **Compact:** Reduce by one step (e.g., `md` → `sm`)226 - **Default:** Standard spacing227 - **Comfortable:** Increase by one step (e.g., `md` → `lg`)228229---230231## 5. Elevation System232233### 5.1 Shadow Scale234235| Token | Box-Shadow | Use Case |236|-------|-----------|----------|237| `elevation-none` | `none` | Flat elements |238| `elevation-xs` | `0 1px 2px rgba(0,0,0,0.05)` | Subtle cards |239| `elevation-sm` | `0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06)` | Cards, buttons |240| `elevation-md` | `0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06)` | Dropdowns |241| `elevation-lg` | `0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05)` | Modals |242| `elevation-xl` | `0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04)` | Popovers |243| `elevation-2xl` | `0 25px 50px rgba(0,0,0,0.25)` | Full-screen overlays |244245### 5.2 Z-Index Scale246247| Token | Value | Use Case |248|-------|-------|----------|249| `z-base` | 0 | Default stacking |250| `z-raised` | 10 | Sticky elements |251| `z-dropdown` | 100 | Dropdowns, popovers |252| `z-sticky` | 200 | Sticky headers |253| `z-overlay` | 300 | Backdrop overlays |254| `z-modal` | 400 | Modals, dialogs |255| `z-toast` | 500 | Toast notifications |256| `z-tooltip` | 600 | Tooltips |257| `z-max` | 9999 | System-level (debug) |258259---260261## 6. Motion & Animation Guidelines262263### 6.1 Duration Scale264265| Token | Value | Use Case |266|-------|-------|----------|267| `instant` | 0ms | Immediate state change |268| `fastest` | 50ms | Micro-interactions (checkboxes) |269| `fast` | 100ms | Button press, icon change |270| `normal` | 200ms | Standard transitions |271| `slow` | 300ms | Panel slides, modals |272| `slower` | 400ms | Complex animations |273| `slowest` | 500ms | Page transitions |274275### 6.2 Easing Curves276277| Token | Value | Use Case |278|-------|-------|----------|279| `ease-in` | `cubic-bezier(0.4, 0, 1, 1)` | Elements exiting |280| `ease-out` | `cubic-bezier(0, 0, 0.2, 1)` | Elements entering |281| `ease-in-out` | `cubic-bezier(0.4, 0, 0.2, 1)` | Elements moving |282| `spring` | `cubic-bezier(0.34, 1.56, 0.64, 1)` | Playful bounces |283284### 6.3 Motion Principles2852861. **Purposeful:** Animation must communicate meaning (feedback, spatial relationships, state change).2872. **Fast:** Keep durations under 400ms — users shouldn't wait for animations.2883. **Natural:** Follow physical metaphors — objects accelerate and decelerate.2894. **Accessible:** Respect `prefers-reduced-motion`:290```css291@media (prefers-reduced-motion: reduce) {292 *, *::before, *::after {293 animation-duration: 0.01ms !important;294 transition-duration: 0.01ms !important;295 }296}297```298299---300301## 7. Dark Mode Implementation302303### 7.1 Strategy304305Use **semantic tokens** that map to different values per theme — never hardcode colors.306307```css308/* Light theme (default) */309:root {310 --color-bg-primary: #FFFFFF;311 --color-bg-secondary: #F8FAFC;312 --color-text-primary: #0F172A;313 --color-text-secondary: #475569;314 --color-border-default: #E2E8F0;315}316317/* Dark theme */318[data-theme="dark"] {319 --color-bg-primary: #0F172A;320 --color-bg-secondary: #1E293B;321 --color-text-primary: #F1F5F9;322 --color-text-secondary: #94A3B8;323 --color-border-default: #334155;324}325```326327### 7.2 Dark Mode Rules3283291. **Don't invert.** Dark mode is not `filter: invert()`. Design intentionally.3302. **Reduce contrast.** Use off-white text (`#F1F5F9`) not pure white (`#FFFFFF`).3313. **Reduce saturation.** Saturated colors on dark backgrounds cause eye strain.3324. **Elevate with lightness.** Higher surfaces = lighter backgrounds (not shadows).3335. **Test independently.** Dark mode is a first-class citizen — not an afterthought.3346. **Handle images.** Add subtle borders or backgrounds behind transparent images.335336---337338## 8. Component States339340Every interactive component must define these states:341342| State | Visual Cue | Behavior |343|-------|-----------|----------|344| **Default** | Base appearance | Resting state |345| **Hover** | Subtle background/color shift | Mouse enters target area |346| **Focus** | Visible focus ring (2px, offset) | Keyboard navigation |347| **Active/Pressed** | Darker shade, scale down | Mouse down / touch press |348| **Disabled** | Reduced opacity (0.5), no pointer | Non-interactive, `aria-disabled` |349| **Loading** | Spinner or skeleton, disabled interaction | Async operation in progress |350| **Error** | Red border, error icon, message | Validation failure |351| **Success** | Green accent, check icon | Validation pass / operation complete |352| **Selected** | Filled/highlighted state | Active selection in a group |353| **Read-only** | Subtle background, no border | Viewable but not editable |354355### Focus Ring Standard356```css357:focus-visible {358 outline: 2px solid var(--color-primary-500);359 outline-offset: 2px;360 border-radius: var(--border-radius-sm);361}362```363364---365366## 9. Component Specification Format367368### Component Spec Template369```markdown370## Component: [Name]371372**Status:** [Draft | In Review | Approved | Deprecated]373**Version:** [1.0.0]374**Last Updated:** [Date]375**Owner:** [Name]376377### Description378[What this component does and when to use it]379380### Anatomy381[Diagram or list of sub-elements]3821. Container3832. Label3843. Icon (optional)3854. Helper text (optional)386387### Variants388| Variant | Description | Use Case |389|---------|-------------|----------|390| Primary | Filled, high emphasis | Main CTA |391| Secondary | Outlined, medium emphasis | Secondary actions |392| Ghost | Text-only, low emphasis | Tertiary actions |393394### Props / API395| Prop | Type | Default | Required | Description |396|------|------|---------|----------|-------------|397| `variant` | `'primary' \| 'secondary' \| 'ghost'` | `'primary'` | No | Visual variant |398| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | No | Component size |399| `disabled` | `boolean` | `false` | No | Disables interaction |400| `loading` | `boolean` | `false` | No | Shows loading state |401402### Tokens Used403- `color-bg-primary` — Container background404- `color-text-on-primary` — Label text405- `spacing-3` — Horizontal padding406- `border-radius-md` — Corner radius407- `elevation-sm` — Drop shadow408409### States410[Reference the component states table above with component-specific details]411412### Accessibility413- **Role:** `button`414- **Keyboard:** `Enter` / `Space` to activate, `Tab` to focus415- **ARIA:** `aria-disabled`, `aria-busy` (when loading)416- **Contrast:** Label text meets 4.5:1 against container417418### Do / Don't419| ✅ Do | ❌ Don't |420|------|---------|421| Use for primary actions | Use multiple primary buttons in one view |422| Keep labels concise (2–4 words) | Use generic labels like "Click Here" |423| Pair with a secondary button | Stack more than 3 buttons together |424425### Code Example426[Framework-specific implementation snippet]427```428429---430431## 10. Handoff Documentation Format432433### Design-to-Dev Handoff Checklist434```markdown435## Handoff: [Feature / Component]436437**Designer:** [Name]438**Date:** [Date]439**Figma Link:** [URL]440441### Specs Provided442- [ ] All screen states (empty, loading, populated, error)443- [ ] Responsive breakpoints (mobile, tablet, desktop)444- [ ] Dark mode variants445- [ ] Component states (default, hover, active, disabled, focus, error)446- [ ] Spacing and layout specs (using design tokens)447- [ ] Typography specs (using type scale tokens)448- [ ] Color specs (using color tokens, not hex values)449- [ ] Animation/transition specs (duration, easing)450- [ ] Interaction notes (hover behaviors, click areas, gestures)451- [ ] Accessibility annotations (focus order, ARIA roles, alt text)452- [ ] Edge cases (long text, missing data, permissions)453- [ ] Copy/microcopy (finalized, approved)454455### Assets456- [ ] Icons exported (SVG, optimized)457- [ ] Images/illustrations (with alt text)458- [ ] Fonts (licensed, hosted)459460### Notes for Engineering461[Anything unusual, known trade-offs, or implementation preferences]462```463464---465466## Quality Standards4674681. **Token-first.** Never use raw values — always reference design tokens.4692. **Accessible by default.** Every component must meet WCAG 2.1 AA.4703. **Responsive.** Every component must work across mobile, tablet, and desktop.4714. **Dark mode.** Every component must support light and dark themes.4725. **Documented.** Every component must have a spec before development begins.4736. **Versioned.** Use semver for breaking changes, additions, and patches.4747. **Auditable.** Run periodic visual consistency audits against the token system.4758. **Platform-agnostic tokens.** Tokens must transform to any target platform.