Skip to Content
Puzzle

Design Tokens

The typed token groups that Theme resolves into --puzzle-* CSS custom properties.

All of Puzzle's design values live in a single typed ThemeTokens object. Theme merges your overrides into the defaults and emits every value as a --puzzle-* CSS custom property. Components never hardcode design values; they reference these variables.

Overriding tokens

Pass a deep-partial tokens object to Theme. Anything you omit keeps its default. Unknown token names throw a TypeError, so typos are caught immediately:

<Theme
  tokens={{
    radius: { md: "0.5rem" },
    spacing: { 4: "1.125rem" },
    motion: { normal: "240ms" },
  }}
>
  <App />
</Theme>

Every value is validated as a safe CSS value before it is injected.

Token groups

Spacing

Emitted as --puzzle-space-{key}.

KeyDefault
00
px1px
0.50.125rem
10.25rem
1.50.375rem
20.5rem
30.75rem
41rem
51.25rem
61.5rem
82rem
102.5rem
123rem
164rem
205rem
246rem

Radius

Emitted as --puzzle-radius-{key}.

KeyDefault
none0
sm0.125rem
md0.375rem
lg0.5rem
xl0.75rem
2xl1rem
3xl1.5rem
full9999px

Shadows

Emitted as --puzzle-shadow-{key} with keys none, xs, sm, md, lg, and xl.

Elevation

A finer-grained elevation scale emitted as --puzzle-elevation-{key} with keys 1, 2, 3, 4, 6, 8, 12, 16, and 24. Use elevation for layered surfaces such as cards, menus, and dialogs.

Borders

TokenCSS variableDefault
borders.width--puzzle-border-width1px
borders.widthStrong--puzzle-border-width-strong2px
borders.style--puzzle-border-stylesolid

Layout

TokenCSS variableDefault
layout.container--puzzle-container-width80rem
layout.content--puzzle-content-width64rem
layout.prose--puzzle-prose-width65ch

A responsive gutter, --puzzle-container-gutter: clamp(2rem, 6vw, 6rem), is provided by the base stylesheet.

Breakpoints

Emitted as --puzzle-breakpoint-{key} with keys tablet (768px), desktop (1024px), and hd (1440px). See Breakpoints for the JavaScript constants.

Overlays

TokenCSS variableDefault
overlays.backdrop--puzzle-overlay-backdroprgb(0 0 0 / 0.35)
overlays.backdropBlur--puzzle-overlay-backdrop-blur2px

Motion

TokenCSS variableDefault
motion.fast--puzzle-duration-fast120ms
motion.normal--puzzle-duration-normal200ms
motion.slow--puzzle-duration-slow320ms
motion.easingStandard--puzzle-easing-standardcubic-bezier(0.2, 0, 0, 1)
motion.easingIn--puzzle-easing-incubic-bezier(0.4, 0, 1, 1)
motion.easingOut--puzzle-easing-outcubic-bezier(0, 0, 0.2, 1)

Z-index

Emitted as --puzzle-z-index-{key}.

KeyDefault
base0
dropdown100
sticky200
navigation250
overlay300
modal400
popover500
toast600
tooltip700

Colors and typography

Color scheme tokens are documented on the Colors page, and typography scales and roles on the Typography & Fonts page.

Using tokens in CSS

Reference the variables directly in component styles:

.my-panel {
  background: var(--puzzle-color-surface);
  border: var(--puzzle-border-width) var(--puzzle-border-style)
    var(--puzzle-color-border);
  border-radius: var(--puzzle-radius-lg);
  box-shadow: var(--puzzle-elevation-2);
  padding: var(--puzzle-space-4);
  transition: box-shadow var(--puzzle-duration-normal)
    var(--puzzle-easing-standard);
}

Prefer semantic tokens over raw values so your styles respond to theme changes, token overrides, and light/dark mode automatically.

;