Navigated to /docs/ui/tokens

Design tokens

Use generated semantic variables so components and application surfaces adapt together across brands and color modes.

Think in three token layers

  • Color ramps preserve the generated shades for primary, secondary, and neutral anchors.

  • Semantic mode tokens describe intent: backgrounds, text, borders, actions, feedback, overlays, panels, headers, and sidebars.

  • Static tokens describe spacing, sizing, radius, typography, motion, focus, blur, opacity, and breakpoints.

Application code should normally consume semantic or static tokens. Direct ramp shades are useful for visualization and tooling, but they couple product CSS to palette details.

Use tokens for product-specific CSS

Tavo.js UI components already consume the token contract. When a product-specific class is still necessary, reference the same variables so custom sections respond to theme and scale changes.

CSS
css.projectSummary {
  color: var(--tui-color-text);
  background: var(--tui-color-panel-bg);
  border: var(--tui-border-width) solid var(--tui-color-panel-border);
  border-radius: var(--tui-radius-surface);
  padding: var(--tui-space-6);
}

Override by intent, not by accident

tokens.light and tokens.dark apply after generated semantic tokens. Use them for a small number of product aliases that genuinely need a fixed value, then run the accessibility audit again.

JSON
json{
  "tokens": {
    "light": { "color-sidebar-bg": "#ffffff" },
    "dark": { "color-sidebar-bg": "#050505" }
  }
}

Use the published token names

Spacing uses a numeric scale, not named md or lg variables. Component gap names map onto that scale: sm uses space-2, md uses space-4, and lg uses space-6.

CSS
css.productPanel {
  color: var(--tui-color-text);
  background: var(--tui-color-panel-bg);
  border: var(--tui-border-width) solid var(--tui-color-panel-border);
  border-radius: var(--tui-radius-surface);
  padding: var(--tui-space-6);
}

Inspect the token catalog programmatically

  • tavoUiTokenNames is the built-in variable-name inventory.

  • tavoUiTokenMetadata includes each name and its token group.

  • getTavoUiTokenMetadata(config) adds project-defined override names.

  • Use tavo-ui validate-css to find unknown Tavo.js UI variables in application stylesheets.

TS
tsimport {
  getTavoUiTokenMetadata,
  getTavoUiTokenGroup,
  tavoUiTokenMetadata,
  tavoUiTokenNames
} from "@tavojs/ui/theme";

tavoUiTokenNames.includes("--tui-space-4");
getTavoUiTokenGroup("--tui-color-panel-bg");

// Includes custom entries from tokens.light and tokens.dark.
const projectTokens = getTavoUiTokenMetadata(config);

Apply project token overrides

Theme generation emits the canonical --tui variable contract. Use tokens.light and tokens.dark to replace generated values or add project-specific variables for each mode.

  • tokens.light and tokens.dark apply after generated semantic values.

  • An override name does not need to be built in; generated custom names use the canonical --tui prefix.

  • Re-run contrast and CSS-token audits after overriding foreground or background colors.

CSS
css--tui-color-panel-bg: #ffffff;
--tui-product-accent: #7c3aed;

Account for generated global CSS

  • All elements and pseudo-elements receive border-box sizing.

  • Document scrollbars receive token-backed colors and dimensions.

  • body margin and padding are reset to zero.

  • body receives the generated application-background token.

  • The root selector receives color-scheme, root font sizing, ramps, semantic variables, and static tokens.

Complete token inventory

125 public CSS variables are synchronized from the current theme package. Generated values may differ when your project changes its theme configuration.

--tui-backdrop-filtereffects · backdrop-filter
--tui-blur-surfaceeffects · blur-surface
--tui-border-widthborder · border-width
--tui-border-width-strongborder · border-width-strong
--tui-breakpoint-lgbreakpoint · breakpoint-lg
--tui-breakpoint-mdbreakpoint · breakpoint-md
--tui-breakpoint-smbreakpoint · breakpoint-sm
--tui-color-app-bgcolor · color-app-bg
--tui-color-bgcolor · color-bg
--tui-color-bordercolor · color-border
--tui-color-border-strongcolor · color-border-strong
--tui-color-dangercolor · color-danger
--tui-color-danger-surfacecolor · color-danger-surface
--tui-color-danger-surface-textcolor · color-danger-surface-text
--tui-color-focuscolor · color-focus
--tui-color-focus-ringcolor · color-focus-ring
--tui-color-header-bgcolor · color-header-bg
--tui-color-header-bordercolor · color-header-border
--tui-color-headingcolor · color-heading
--tui-color-infocolor · color-info
--tui-color-linkcolor · color-link
--tui-color-neutral-bgcolor · color-neutral-bg
--tui-color-neutral-bg-hovercolor · color-neutral-bg-hover
--tui-color-neutral-textcolor · color-neutral-text
--tui-color-overlay-bgcolor · color-overlay-bg
--tui-color-panel-bgcolor · color-panel-bg
--tui-color-panel-bordercolor · color-panel-border
--tui-color-primary-bgcolor · color-primary-bg
--tui-color-primary-bg-hovercolor · color-primary-bg-hover
--tui-color-primary-soft-bgcolor · color-primary-soft-bg
--tui-color-primary-soft-textcolor · color-primary-soft-text
--tui-color-primary-textcolor · color-primary-text
--tui-color-secondary-bgcolor · color-secondary-bg
--tui-color-secondary-bg-hovercolor · color-secondary-bg-hover
--tui-color-secondary-soft-bgcolor · color-secondary-soft-bg
--tui-color-secondary-soft-textcolor · color-secondary-soft-text
--tui-color-secondary-textcolor · color-secondary-text
--tui-color-selection-bgcolor · color-selection-bg
--tui-color-selection-textcolor · color-selection-text
--tui-color-sidebar-bgcolor · color-sidebar-bg
--tui-color-sidebar-bordercolor · color-sidebar-border
--tui-color-successcolor · color-success
--tui-color-surfacecolor · color-surface
--tui-color-surface-raisedcolor · color-surface-raised
--tui-color-surface-subtlecolor · color-surface-subtle
--tui-color-textcolor · color-text
--tui-color-text-mutedcolor · color-text-muted
--tui-color-warningcolor · color-warning
--tui-focus-offsetfocus · focus-offset
--tui-focus-widthfocus · focus-width
--tui-font-familytypography · font-family
--tui-font-family-headingtypography · font-family-heading
--tui-font-family-texttypography · font-family-text
--tui-font-size-bodytypography · font-size-body
--tui-font-size-captiontypography · font-size-caption
--tui-font-size-h1typography · font-size-h1
--tui-font-size-h2typography · font-size-h2
--tui-font-size-h3typography · font-size-h3
--tui-font-size-labeltypography · font-size-label
--tui-glass-chrome-alphaeffects · glass-chrome-alpha
--tui-interaction-active-scaleinteraction · interaction-active-scale
--tui-interaction-disabled-opacityinteraction · interaction-disabled-opacity
--tui-interaction-focus-alphainteraction · interaction-focus-alpha
--tui-interaction-hover-liftinteraction · interaction-hover-lift
--tui-interaction-hover-shadow-opacityinteraction · interaction-hover-shadow-opacity
--tui-interaction-transition-baseinteraction · interaction-transition-base
--tui-interaction-transition-fastinteraction · interaction-transition-fast
--tui-motion-basemotion · motion-base
--tui-motion-easemotion · motion-ease
--tui-motion-fastmotion · motion-fast
--tui-motion-slowmotion · motion-slow
--tui-neutral-100color · neutral-100
--tui-neutral-200color · neutral-200
--tui-neutral-300color · neutral-300
--tui-neutral-400color · neutral-400
--tui-neutral-50color · neutral-50
--tui-neutral-500color · neutral-500
--tui-neutral-600color · neutral-600
--tui-neutral-700color · neutral-700
--tui-neutral-800color · neutral-800
--tui-neutral-900color · neutral-900
--tui-neutral-950color · neutral-950
--tui-opacity-disabledopacity · opacity-disabled
--tui-opacity-mutedopacity · opacity-muted
--tui-primary-100color · primary-100
--tui-primary-200color · primary-200
--tui-primary-300color · primary-300
--tui-primary-400color · primary-400
--tui-primary-50color · primary-50
--tui-primary-500color · primary-500
--tui-primary-600color · primary-600
--tui-primary-700color · primary-700
--tui-primary-800color · primary-800
--tui-primary-900color · primary-900
--tui-primary-950color · primary-950
--tui-radius-controlradius · radius-control
--tui-radius-lgradius · radius-lg
--tui-radius-mdradius · radius-md
--tui-radius-smradius · radius-sm
--tui-radius-surfaceradius · radius-surface
--tui-secondary-100color · secondary-100
--tui-secondary-200color · secondary-200
--tui-secondary-300color · secondary-300
--tui-secondary-400color · secondary-400
--tui-secondary-50color · secondary-50
--tui-secondary-500color · secondary-500
--tui-secondary-600color · secondary-600
--tui-secondary-700color · secondary-700
--tui-secondary-800color · secondary-800
--tui-secondary-900color · secondary-900
--tui-secondary-950color · secondary-950
--tui-shadow-lgeffects · shadow-lg
--tui-shadow-mdeffects · shadow-md
--tui-shadow-smeffects · shadow-sm
--tui-size-lgsizing · size-lg
--tui-size-mdsizing · size-md
--tui-size-smsizing · size-sm
--tui-size-xlsizing · size-xl
--tui-size-xssizing · size-xs
--tui-space-1spacing · space-1
--tui-space-2spacing · space-2
--tui-space-3spacing · space-3
--tui-space-4spacing · space-4
--tui-space-5spacing · space-5
--tui-space-6spacing · space-6