Bonsai Design System

Design Tokens

CSS custom properties that define the visual language

Color Hierarchy

The design system uses a 3-level surface hierarchy:

LevelTokenLightnessPurpose
0--background97%Page canvas
1--card100%Content containers
2--muted93.5%Nested elements within cards

Token Roles

TokenPurpose
--primaryBrand color, CTAs
--secondarySubtle buttons, badges
--accentHover/focus states
--mutedNested surfaces
--destructiveDanger actions
--borderBorders
--inputInput borders
--ringFocus rings

Color Spaces

Tokens use modern CSS color spaces:

  • oklch() for grays and semantic colors (perceptually uniform)
  • lab() for the primary/brand color (precise hue control)

Dark Mode

Toggle dark mode by adding the .dark class to your root element. All tokens automatically remap to dark variants.

High Contrast

Add the data-high-contrast attribute for WCAG AAA compliance. Works with both light and dark modes.

Multi-Brand Theming

Override tokens per brand using data attributes:

[data-brand="your-product"] {
  --primary: oklch(50% 0.2 250);
  --ring: oklch(50% 0.2 250);
}

On this page