The Problem Without Tokens
Imagine a primary brand color, purple #9333EA. Without tokens, this value lives in:
- Figma fill swatches (hardcoded hex)
- CSS files (
background-color: #9333EA) - SCSS variables (
$brand: #9333EA) - Mobile apps (UIColor, Color resources)
- Documentation screenshots
When the brand color changes, every one of those locations must be found and updated manually. Some get missed. Inconsistency creeps in. The design system drifts.
The Solution: Named Variables
A design token replaces the raw value with a name that carries intent:
/* Before — raw values everywhere */
background-color: #9333EA;
color: #FFFFFF;
border-radius: 8px;
font-size: 14px;
/* After — tokens with meaning */
background-color: var(--brand-color);
color: var(--brand-on-color);
border-radius: var(--radius-md);
font-size: var(--font-size-sm);
Three Core Benefits
Change one token definition and every component in every platform updates. No hunting, no drift.
Dark mode, multiple brands, seasonal themes — all handled by switching which values the tokens resolve to. Zero component changes.
Figma variables and CSS custom properties use the same token names. When Figma changes, code follows the same spec automatically.
Tokens Carry Intent, Not Just Values
The real power is semantic naming. Compare these two approaches to the same color:
| Approach | Variable name | What it tells you |
|---|---|---|
| Raw value | #9333EA |
Nothing — just a hex. Where is it used? Can it be changed? |
| Descriptive name | purple-600 |
It's purple, medium shade. Still says nothing about where to use it. |
| Semantic token | brand-color |
It's the brand's primary accent. Use it for filled backgrounds, active states, CTAs. |
| Component token | button-bg |
It's the background of a button. Resolves to whatever the brand's primary color is. |
brand-color is good. purple is bad.
How CocoKits Uses Tokens
CocoKits uses a three-tier token architecture:
Each tier only references the tier directly above it. Primitives hold raw values. Semantic tokens alias primitives with meaning. Component tokens alias semantic tokens with context. This creates a stable, predictable chain where changes flow naturally downward.