CORRECTIV Design Tokens

Shared design tokens for CORRECTIV web projects. Provides CSS custom properties and a Tailwind v4 theme config as a single source of truth.

Table of Contents

Usage

Add to package.json devDependencies (you can reference any Git ref):

"wp-design-tokens": "correctiv/wp-design-tokens#<ref>"

Import whichever files you need in your CSS entry point after installing the package:

/* CSS custom properties + Tailwind theme */
@import "wp-design-tokens/theme.css";

/* CSS custom properties + Tailwind theme, with a Tailwind prefix */
@import "wp-design-tokens/theme.css" prefix(tw);

/* Composite typography utilities */
@import "wp-design-tokens/typography.css";

/* Custom Tailwind utilities (baseline grid, duration) */
@import "wp-design-tokens/utility.css";

Tailwind theme

theme.css wires all design tokens into Tailwind's utility system via @theme inline, replacing the entire default Tailwind theme. Every token becomes a utility class — colors, spacing, typography, radius, and duration — with no configuration needed in the consuming project.

<p
  class="tw:font-serif tw:text-article tw:tracking-wider tw:leading-looser tw:text-grey-700"
></p>
<div class="tw:bg-emphasis tw:p-m tw:rounded-md"></div>

The full list of available tokens, class names, and values is in Available Design Tokens.

Typography classes

typography.css provides ready-made composite Tailwind utilities that bundle font-family, size, weight, letter-spacing, and line-height:

Utility classes

utility.css registers two custom Tailwind utilities:

Available Design Tokens

All tokens are defined in css/theme.css. --var-* properties can be used directly in any CSS; Tailwind utility classes are derived from the @theme inline block. Note that --*: initial resets all Tailwind defaults — only the tokens below are available as utilities.

Tailwind class names below omit any project-level prefix (e.g. tw:). If a prefix is configured, prepend it: tw:text-article.

Typography

Fonts

Token CSS Custom Property Tailwind Class Value
Serif --var-font-serif font-serif "Merriweather", sans-serif
Sans --var-font-sans font-sans "Source Sans 3", sans-serif

Font Weights

Token CSS Custom Property Tailwind Class Value
Normal --var-font-weight-normal font-normal 400
Semibold --var-font-weight-semibold font-semibold 600
Bold --var-font-weight-bold font-bold 700

Font Sizes

Font sizes are responsive; values change at the 48rem (768 px) breakpoint. A single value means no breakpoint change. --text-* tokens are Tailwind font-size utilities; --headline-* tokens are CSS variables used via the arbitrary-value shorthand.

Token CSS Custom Property Tailwind Class Value (mobile / tablet)
Aa Text S --var-font-size-text-s text-s 14 px / 15 px
Aa Text M --var-font-size-text-m text-m 15 px / 17 px
Aa Text Article --var-font-size-text-article text-article 15.5 px / 17.5 px
Aa Text Button --var-font-size-text-button text-button 16 px
Aa Text L --var-font-size-text-l text-l 18.5 px / 20 px
Aa Headline XS --var-font-size-headline-xs text-(--headline-xs) 17 px
Aa Headline S --var-font-size-headline-s text-(--headline-s) 17 px / 20 px
Aa Headline M --var-font-size-headline-m text-(--headline-m) 19 px / 23 px
Aa Headline L --var-font-size-headline-l text-(--headline-l) 23 px / 30 px
Aa Headline XL --var-font-size-headline-xl text-(--headline-xl) 28 px / 40 px
Aa Headline XXL --var-font-size-headline-xxl text-(--headline-xxl) 32 px / 50 px

Letter Spacing

Token CSS Custom Property Tailwind Class Value
AaBb Tighter --var-letter-spacing-tighter tracking-tighter −0.2 px
AaBb Tight --var-letter-spacing-tight tracking-tight −0.1 px
AaBb Normal --var-letter-spacing-normal tracking-normal 0 px
AaBb Wide --var-letter-spacing-wide tracking-wide 0.1 px
AaBb Wider --var-letter-spacing-wider tracking-wider 0.2 px

Word Spacing

Token CSS Custom Property Tailwind Class Value
Normal --var-word-spacing-normal word-spacing-normal* 0.109375 rem (1.75 px)

* Requires utility.css.

Leading (line height)

Token CSS Custom Property Tailwind Class Value
Tighter --var-leading-tighter leading-tighter 1.1
Tight --var-leading-tight leading-tight 1.2
Snug --var-leading-snug leading-snug 1.3
Normal --var-leading-normal leading-normal 1.4
Relaxed --var-leading-relaxed leading-relaxed 1.45
Loose --var-leading-loose leading-loose 1.5
Looser --var-leading-looser leading-looser 1.8

Layout

Container Widths

Token CSS Custom Property Tailwind Class Value
Container --var-container max-w-(--container) 62.5 rem (1000 px)
Container content --var-container-content max-w-(--container-content) 38.75 rem (620 px)

Spacing Scale

Tokens are available for all spacing utilities: p-{name}, m-{name}, gap-{name}, w-{name}, h-{name}, etc. The base unit --spacing (0.125 rem) drives numeric utilities: p-4 = 4 × 0.125 rem = 0.5 rem.

Token CSS Custom Property Tailwind Class Value
4XS --var-spacing-4xs p-4xs 0.125 rem (2 px)
3XS --var-spacing-3xs p-3xs 0.25 rem (4 px)
2XS --var-spacing-2xs p-2xs 0.375 rem (6 px)
XS --var-spacing-xs p-xs 0.5 rem (8 px)
S --var-spacing-s p-s 0.75 rem (12 px)
SM --var-spacing-sm p-sm 1 rem (16 px)
M --var-spacing-m p-m 1.5 rem (24 px)
ML --var-spacing-ml p-ml 2 rem (32 px)
L --var-spacing-l p-l 2.25 rem (36 px)
XL --var-spacing-xl p-xl 3 rem (48 px)
2XL --var-spacing-2xl p-2xl 4 rem (64 px)
3XL --var-spacing-3xl p-3xl 6 rem (96 px)
4XL --var-spacing-4xl p-4xl 8 rem (128 px)

Colors

Color tokens are available with any Tailwind color utility prefix: bg-{name}, text-{name}, border-{name}, etc.

Tokens are layered: primitives are the raw palette; semantic tokens describe an intended use (accent, background, foreground, stroke) and are built from primitives. Prefer semantic tokens in product code - primitives exist mainly to back them.

Primitives

Neutrals use a numeric scale rather than "grey", to distinguish this tonal ramp from chromatic color families - lower numbers are lighter, and only the positions currently needed are defined. Black and white are named independently, as absolute endpoints rather than designed tonal steps. Red and yellow are individual brand colors rather than full ramps; their numeric position (red-500, yellow-400) reflects where they'd sit in a future ramp, so more steps can be added later without renaming – red-500 anchors the pure hue at the ramp's center (no tints or shades mixed in), while yellow-400 is positioned slightly higher to preserve room for lighter variants and prevent compression of darker tones.

Token CSS Custom Property Tailwind Class Value
Black --var-color-black bg-black · text-black #000000
White --var-color-white bg-white · text-white #ffffff
Neutral 100 --var-color-neutral-100 bg-neutral-100 · text-neutral-100 #f8f8f8
Neutral 200 --var-color-neutral-200 bg-neutral-200 · text-neutral-200 #e6e6e6
Neutral 300 --var-color-neutral-300 bg-neutral-300 · text-neutral-300 #cecece
Neutral 400 --var-color-neutral-400 bg-neutral-400 · text-neutral-400 #b3b3b3
Neutral 500 --var-color-neutral-500 bg-neutral-500 · text-neutral-500 #707070
Neutral 600 --var-color-neutral-600 bg-neutral-600 · text-neutral-600 #4a4a4a
Neutral 700 --var-color-neutral-700 bg-neutral-700 · text-neutral-700 #333333
Red 500 --var-color-red-500 bg-red-500 · text-red-500 #ff5064
Yellow 400 --var-color-yellow-400 bg-yellow-400 · text-yellow-400 #fde162

Semantic

Accent colors are used to draw attention. Named functionally rather than brand-primary/-secondary, though "accent" is effectively CORRECTIV's branding - there is deliberately no top-level "brand" family, since every color here is assumed to express brand.

Background describes context via 3 roles, named rather than numbered (-1/-2/-3) for memorable, readable usage; the "-background" suffix is omitted since the names already say so:

Foreground (aka text) colors pick up a background role with an "-on-" prefix, to express which context they're intended for. Named "foreground" rather than "text" since it also covers icons and other non-text elements. Modifiers (-muted, -accent) can be appended as needed.

Stroke describes colors for linear elements - borders, dividers, line iconography - that provide structure without competing with content.

Token CSS Custom Property Tailwind Class Value
Accent --var-color-accent bg-accent · text-accent --var-color-red-500
Accent alternative --var-color-accent-alternative bg-accent-alternative · text-accent-alternative --var-color-yellow-400
Background --var-color-background bg-background --var-color-neutral-100
Canvas --var-color-canvas bg-canvas --var-color-white
Surface --var-color-surface bg-surface --var-color-neutral-100
Foreground on background --var-color-on-background text-on-background --var-color-neutral-600
Foreground on canvas --var-color-on-canvas text-on-canvas --var-color-neutral-700
Foreground on surface --var-color-on-surface text-on-surface --var-color-neutral-700
Foreground on canvas, muted --var-color-on-canvas-muted text-on-canvas-muted --var-color-neutral-500
Foreground on canvas, accent --var-color-on-canvas-accent text-on-canvas-accent --var-color-accent
Stroke --var-color-stroke border-stroke · fill-stroke --var-color-neutral-300
Stroke, strong --var-color-stroke-strong border-stroke-strong · fill-stroke-strong --var-color-neutral-400

Deprecated (v1)

Superseded by the primitive/semantic tokens above. Values are unchanged - kept as aliases until all submodules migrate, then removed in a future version.

Token CSS Custom Property Tailwind Class Value
Emphasis --var-color-emphasis bg-emphasis · text-emphasis #ff5064
Alternative --var-color-alternative bg-alternative · text-alternative #fde162
Grey 100 --var-color-grey-100 bg-grey-100 · text-grey-100 #ffffff
Grey 200 --var-color-grey-200 bg-grey-200 · text-grey-200 #f8f8f8
Grey 250 --var-color-grey-250 bg-grey-250 · text-grey-250 #f0f0f0
Grey 300 --var-color-grey-300 bg-grey-300 · text-grey-300 #e6e6e6
Grey 400 --var-color-grey-400 bg-grey-400 · text-grey-400 #cecece
Grey 500 --var-color-grey-500 bg-grey-500 · text-grey-500 #b3b3b3
Grey 600 --var-color-grey-600 bg-grey-600 · text-grey-600 #707070
Grey 700 --var-color-grey-700 bg-grey-700 · text-grey-700 #333333

Radius

Token CSS Custom Property Tailwind Class Value
XS --var-radius-xs rounded-xs 0.0625 rem (1 px)
S --var-radius-s rounded-s 0.125 rem (2 px)
MD --var-radius-md rounded-md 0.3125 rem (5 px)

Duration

Token CSS Custom Property Tailwind Class Value
Fast --var-duration-fast duration-fast* 0.2 s
Slow --var-duration-slow duration-slow* 0.4 s

* Requires utility.css.

Updating Tokens

Apply changes

  1. Edit the relevant file under css/.
  2. Update the README to reflect current state.
  3. Commit & push your changes (follow conventional commit format).

Publish changes

  1. git tag -a v0.4.0 -m "v0.4.0 – Summary of changes" – instead of "v0.4.0" put the actual semantic version number.
  2. Create a release via the Github Release feature (using "v0.4.0 – Summary of changes" as the release title).

Update consuming repos

  1. Pin the new version in package.json: "wp-design-tokens": "correctiv/wp-design-tokens#v0.4.0"
  2. Run npm install.