Skip to content
HELiX

Design Tokens Overview

apps/docs/src/content/docs/design-tokens/overview Click to copy
Copied! apps/docs/src/content/docs/design-tokens/overview

HELIX uses a three-tier design token system with CSS custom properties. Tokens are generated using a custom build pipeline (generate-css.ts) that reads tokens.json and outputs production CSS.

┌────────────────────────────────────────────┐
│ Component Tokens (Tier 3) │
│ --hx-button-bg, --hx-card-padding │
│ Component-specific, references Semantic │
├────────────────────────────────────────────┤
│ Semantic Tokens (Tier 2) │
│ --hx-color-text-primary, --hx-body-bg │
│ Semantic meaning, references Primitive │
├────────────────────────────────────────────┤
│ Primitive Tokens (Tier 1) │
│ --hx-color-primary-500, --hx-space-4 │
│ Raw values, brand-agnostic │
└────────────────────────────────────────────┘
CategoryCountExamplePurpose
Color8 ramps + semantic--hx-color-primary-500Brand, status, surface, text, border
Space20--hx-space-4Padding, margins, gaps
Fontfamily, size, weight--hx-font-size-lgFont families, sizes, weights
Line Height5--hx-line-height-normalText line heights
Letter Spacing6--hx-letter-spacing-tightTracking
Borderradius + width--hx-border-radius-mdBorder radii and widths
Shadow7--hx-shadow-lgBox shadows for elevation
Duration6--hx-duration-fastAnimation/transition durations
Easing7--hx-easing-defaultTiming functions
Transition3--hx-transition-normalShorthand transitions
Focus6--hx-focus-ring-widthFocus ring styling
Z-Index9--hx-z-index-modalStacking layers
Opacity10--hx-opacity-disabledTransparency levels
Size16--hx-size-touch-targetFixed dimensions
Container6--hx-container-lgLayout widths
Breakpoint5--hx-breakpoint-mdResponsive breakpoints

HELIX ships with three built-in themes:

  1. Light — Default theme for standard usage
  2. Dark — Dark mode with adjusted contrast, surfaces, and shadows
  3. High Contrast — Accessibility mode for users who require enhanced contrast ratios

Themes are applied via attributes on the document root or automatically via media queries:

  • Dark: data-theme="dark" or @media (prefers-color-scheme: dark)
  • High Contrast: data-hx-contrast="high" or @media (prefers-contrast: more)

Tokens are defined in tokens.json and processed by generate-css.ts to output:

  • :root CSS with all light-mode tokens
  • @media (prefers-color-scheme: dark) overrides
  • [data-theme="dark"] manual override block
  • @media (prefers-contrast: more) high-contrast overrides
  • [data-hx-contrast="high"] manual high-contrast block
  • Lit CSSResult for shadow DOM consumption