Skip to content

Design Tokens

How Cynosure's W3C DTCG design tokens work — categories, primitives vs. semantic tokens, and how to consume or override them.

Every visual decision in Cynosure lives as a token in @arshad-shah/cynosure-tokens. Tokens are authored in W3C DTCG JSON and compiled by Style Dictionary to:

  • dist/css/base.css:root { --cynosure-*: …; } primitives + semantic tokens for the light theme.
  • dist/css/dark.css — semantic overrides for dark mode.
  • dist/ts/*.ts — typed TS constants (rarely needed by consumers; mostly used by Cynosure internals).
CategoryExampleUsage
Colour--cynosure-color-accent-solidButtons, links, focus rings
Space--cynosure-space-3Gaps, padding, margins
Radius--cynosure-radius-component-mdInputs, buttons, cards
Shadow--cynosure-shadow-mdElevated surfaces
Typography--cynosure-font-body-md-sizeFont size + line-height pairs
Breakpoint--cynosure-bp-mdUsed by LayoutProps
Focus--cynosure-shadow-focus-ringFocus ring on interactives
Motion--cynosure-duration-fastTransition durations
  • Primitive tokens (--cynosure-color-blue-500) are the palette.
  • Semantic tokens (--cynosure-color-accent-solid) are named by purpose and are what components consume.

Themes override semantic tokens. The palette stays put.

You rarely need to read tokens directly — most styling happens via Cynosure props or component variants. For custom CSS, reference the custom properties:

.my-hero {
background: var(--cynosure-color-surface-subtle);
color: var(--cynosure-color-fg-default);
border-radius: var(--cynosure-radius-component-lg);
padding: var(--cynosure-space-6);
}

Scope overrides to a selector — :root for global, [data-theme='mine'] or a container class for local:

[data-theme='brand'] {
--cynosure-color-accent-solid: #0f766e;
--cynosure-color-accent-solid-hover: #115e59;
}

See Custom themes for the full theme-authoring flow.