elements
Start Docs Blog Demos UI Pricing
Elements Manual
  • Getting Started
  • CLI
  • Build
  • Browser
  • Packages
  • TypeScript
  • Elements HTML
  • Assets
  • RPC
  • Router
  • Session
  • Database
  • Migrations
  • LiveTable
  • Channel
  • Jobs
  • Email
  • Payments
  • JSON
  • Async
  • Style
    • Install
    • Tokens
      • Color tokens
      • Scale tokens
      • Component tokens
    • Base elements
    • Typography
    • Layout
    • Components
    • Utilities
    • Theming
    • Overriding
    • Email
    • Reference
  • UI
  • JSOC
  • Config
  • Tests
  • Logs
  • Deploy
  • Editors
  • Recipes
  • Licenses
  • Issues
  • Changelog
Manual / Style/ Tokens

Tokens

elements man style/tokens

On This Page

  • The three token tiers
  • Consume semantic tokens, not raw ramps
  • Where each tier is defined
  • Topics

Every visual decision in the system is a CSS custom property, a token. App CSS consumes tokens; it does not hardcode values. This is what makes rebranding, dark mode, and density adjustments one-line changes.

The three token tiers

Tokens are defined in three tiers, each in its own file. A later tier sets its tokens from the tokens of an earlier tier, or overrides them.

Tier 1: the scale (primitives). tokens/scale.css defines the raw, non-color scales: the type ramp, weights, leading and tracking, the spacing scale, radius, shadows, motion, z-index layering, breakpoint reference values, and container widths. Examples are --space-4, --text-lg and --radius-md. They don't change between themes. See scale (opens in a new tab).

Tier 2: the semantic theme. themes/default.css defines the color ramps (one neutral + four status ramps in OKLCH) and then maps them onto semantic tokens: --bg, --ink, --rule, --accent, the status triples, focus rings, and the per-component slots. It also gives those semantic tokens their dark-mode values. Your app's CSS reads the tokens of this tier. See color (opens in a new tab) and components (opens in a new tab).

Tier 3: the optional brand theme. A theme file imported after the default repoints the accent block (and optionally a brand ramp) to color the whole system. themes/elements.css is the shipped example; themes/customer-example.css is the documented recipe. See theming (opens in a new tab).

Token tiers
scale.css primitives --space-4, --text-lg, --radius-md ↓ themes/default semantic tokens --ink → --neutral-900, --accent → --neutral-900 ↓ brand theme repoint accent --accent → your brand ramp (optional)

Consume semantic tokens, not raw ramps

The neutral and status ramps (--neutral-500, --danger-600, …) exist so the semantic tokens have something to point at. In app CSS, use the semantic token, not the ramp step:

Example
/* Do this: follows the theme and dark mode automatically */ .notice { color: var(--ink-soft); background: var(--bg-soft); border: 1px solid var(--rule); } /* Not this: a raw ramp step won't flip in dark mode */ .notice { color: var(--neutral-700); background: var(--neutral-50); }

--ink-soft is --neutral-700 in light mode and --neutral-300 in dark mode. Use the semantic token and your rule gets the right value in both modes. Use the ramp step and your rule keeps one value in both modes and under every theme.

Where each tier is defined

Tier File Layer
Scale primitives tokens/scale.css tokens
Semantic theme + colors + dark mode themes/default.css tokens
Brand theme (opt-in) themes/elements.css tokens

All three are in @layer tokens, the second layer in the order, so your app's own token overrides apply over them when they are in a later layer, outside any layer, or later in @layer tokens. See overriding (opens in a new tab).

  • reference/tokens (opens in a new tab): every token name to use, on one page, names only. Start here to look a name up.
  • color (opens in a new tab): the neutral and status ramps and every semantic color token.
  • scale (opens in a new tab): type, spacing, radius, shadow, motion, and the rest of the primitives.
  • components (opens in a new tab): the per-component token slots.

Topics

style/tokens/color Raw OKLCH ramps and the semantic tokens that point at them.style/tokens/scale Type, spacing, radius, shadow, motion, and layering primitives.style/tokens/components Per-component token slots for retuning a component in one place.
Prev InstallNext Color tokens
Product
Manual Pricing Compare
Company
History Contact
Legal
Privacy Policy Acceptable Use Terms License Agreement
© Elements Dev Corporation 2026