Design Systems, Component Abstraction and Motion
A design system combines design decisions, reusable components and usage guidelines. For an engineer who does both design and front end, its value is simple: change one place and the whole product stays consistent; build a new page from existing components and it won't drift.
Core concepts
| Layer | Contents | Examples |
|---|---|---|
| Design tokens | The smallest units of design decisions, values referred to by name | color.status.danger, space.3, radius.md |
| Base components | Generic, domain-free components | Button, Input, Dialog, Tooltip, Table |
| Domain components | Built from base components, with domain meaning | StatusPill, StepCard, TimelineItem |
| Patterns | Standard solutions to a class of problems | Empty states, error cards, confirming destructive actions |
| Documentation | Usage, states and accessibility notes for every component | Storybook |
Headless components provide only behavior and accessibility (focus, keyboard, ARIA) with no styling. Radix UI is common in React; in Vue, Reka UI (formerly Radix Vue, since renamed). shadcn/ui adds Tailwind styling on top of Radix and copies the source into your project.
How it works
1. Token layers
| Layer | Purpose | Example |
|---|---|---|
| Primitive / global | Palette and size scales | blue.500 = #3b82f6, space.4 = 16px |
| Semantic / alias | Expresses intent by referencing primitives | color.bg.surface → gray.50, color.status.running → blue.500 |
| Component | Component-specific, optional | button.primary.bg → color.action.primary |
Switching themes (light/dark) only changes which primitives the semantic layer points to; component code stays the same.
In 2025-10 the W3C Design Tokens Community Group published its first stable format specification (Design Tokens Format Module 2025.10). It defines a JSON format ($value, $type, alias references and so on) for exchanging tokens between Figma plugins, Style Dictionary and other tools. How fully tools support this version is to be verified.
{
"color": {
"blue": { "500": { "$type": "color", "$value": "#3b82f6" } },
"status": {
"running": { "$type": "color", "$value": "{color.blue.500}" }
}
}
}In code they usually become CSS custom properties:
:root { --color-status-running: #3b82f6; --space-3: 12px; }
[data-theme="dark"] { --color-status-running: #60a5fa; }
.status-pill[data-status="running"] { color: var(--color-status-running); }2. Component API principles
| Principle | Meaning |
|---|---|
| Variants, not boolean combinations | <StatusPill status="retrying" /> beats <StatusPill yellow spinning /> |
| Composition over configuration | Split complex components into Card.Header, Card.Body (React compound components / Vue slots) instead of 20 props |
| Support controlled and uncontrolled | value + onChange for controlled; defaultValue for uncontrolled |
| Pass through native attributes | Allow className, aria-*, ref |
| Accessibility built in | Correct role, name and keyboard behavior by default |
| Cover every state | Define default / hover / focus / active / disabled / loading / error for each component |
3. What motion is for, and the rules
Motion should express state changes, spatial relationships and cause and effect, not decoration:
| Purpose | Example | Suggested duration |
|---|---|---|
| State change | A step goes from "running" to "done" with an icon transition | 150–250ms |
| Enter / exit | A new event slides into the timeline, a drawer opens | 200–300ms |
| Draw attention | The "needs you" banner emphasizes once | Once, no loop |
| Ongoing activity | A gentle pulse on the running node | Low amplitude, can be turned off |
Durations are common rules of thumb, not a standard; tune them for your product.
prefers-reduced-motion: when the user turns on "reduce motion" in their OS, the media query prefers-reduced-motion: reduce matches. Remove movement, scaling and parallax, keeping only necessary fades or instant changes. WCAG 2.3.3 (Animation from Interactions, level AAA) also asks that motion triggered by interaction can be disabled.
4. Ways to implement motion
| Approach | Good for | Notes |
|---|---|---|
| CSS transition / animation | Simple state transitions | First choice, performs well; animate only transform and opacity |
| View Transitions API | View changes (list → detail, reordering) | document.startViewTransition(); same-document view transitions became Baseline Newly available in 2025-10 |
| Motion (formerly Framer Motion) | Layout animation, gestures and exit animations in React | Renamed to Motion; import from motion/react |
Vue <Transition> / <TransitionGroup> | Enter/leave and list animations in Vue | Built into Vue |
In practice
Building a small design system from scratch
- Inventory the colors, font sizes, spacing and radii used across existing pages and merge them into scales (e.g. spacing in multiples of 4)
- Create two token layers: primitives + semantics; dark mode changes only the semantic layer
- Build 8–10 base components first: Button, Input, Select, Dialog, Tooltip, Tabs, Table, Toast, Badge, Skeleton
- Then domain components: StatusPill, StepCard, TimelineItem, ErrorCard, HumanRequestBanner
- Write Storybook stories covering every state of every component; add the a11y addon for automatic checks
- Write one page of guidelines: color usage, meaning of status colors, tone of copy, motion durations
Respecting reduced motion
.timeline-item { transition: transform 200ms ease, opacity 200ms ease; }
@media (prefers-reduced-motion: reduce) {
.timeline-item { transition: opacity 120ms linear; transform: none; }
}import { motion, useReducedMotion } from 'motion/react'
function NewEvent({ children }: { children: React.ReactNode }) {
const reduce = useReducedMotion()
return (
<motion.li
initial={reduce ? { opacity: 0 } : { opacity: 0, y: -8 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.2 }}
>
{children}
</motion.li>
)
}Common pitfalls
- Tokens with only primitives: components reference
blue.500directly, so changing themes means editing everywhere. - Prop explosion: one component with 30 boolean props produces many untested combinations.
- Copy-pasted "same name, different look" components: two slightly different Buttons, and the design system exists in name only.
- Animating layout properties (
width,top): triggers reflow and jank. Prefertransformandopacity. - Endless looping animations: constantly pull attention, disturb reading and ignore reduced-motion preferences.
- Dark mode as simple inversion: shadows, borders and status colors each need their own tuning to keep contrast.
Common interview questions
- Why split design tokens into primitives and semantics? How do you implement dark mode?
- What problem do headless components solve? How is shadcn/ui different from a traditional component library?
- How would you design the API of a StatusPill or Table component?
- What is motion for in tool products? Where shouldn't you add it?
- How do you use
prefers-reduced-motion? - Why animate
transformandopacityfirst?
Related projects
- This site: themes already use CSS variables for light ("blue sky, white clouds") and dark (graphite), and there are status components such as StatusPill and ProgressBar; this article is the outline for a "design system notes" page.
- Agent Run Console: Storybook shows every state of StatusPill, StepCard and ErrorCard; timeline insert animations and state transitions respect
prefers-reduced-motion. - Related: Tailwind and shadcn/ui.
Sources
- W3C Design Tokens CG: Design Tokens Format Module 2025.10 and the first stable version announcement
- Radix UI docs
- Reka UI: Migration from Radix Vue
- shadcn/ui docs
- Storybook docs / Accessibility tests
- MDN: prefers-reduced-motion
- W3C: Understanding SC 2.3.3 Animation from Interactions
- web.dev: Same-document view transitions are now Baseline Newly available (2025-10-16)
- Motion: React upgrade guide — the Framer Motion rename and importing from
motion/react - Vue docs: Transition
