Design System Foundation
Accessible component library with built-in dark mode and composable primitives.
Overview
A comprehensive design system built on Radix UI primitives, providing accessible, themeable components that work seamlessly in light and dark modes. The system follows compound component patterns for maximum flexibility while maintaining consistency across applications.
Approach
Radix UI for accessibility primitives: keyboard navigation, ARIA attributes, and focus management handled by Radix. No reinventing the wheel for complex widgets (dialogs, dropdowns, tooltips).
Tailwind for styling: utility classes scoped to component internals. Variants are class-map objects, not runtime conditional logic.
CSS custom properties for theming: all colours and spacing tokens are CSS variables that cascade. Dark mode is a data-theme="dark" attribute swap, zero JS required for the switch, no FOUC.
Tree-shakeable exports: each component is a separate export. No import * from 'design-system' importing everything. Bundle impact matches usage.
Component API
Challenges
The main design challenge: making components flexible enough to cover real use cases without fragmenting into inconsistent one-offs. The solution is sensible defaults overridable at three levels: global theme, component variant, and instance props. Callers override only what differs.
Animation timing across colour modes was a specific edge case. Some animations (e.g. skeleton loaders) need different speeds in dark mode. This is handled via CSS custom properties for --duration-X tokens that can be redefined per theme, no JS involved.
Tech Stack
React · TypeScript · Radix UI · Tailwind CSS · Storybook · Vite