Skip to main content
DrupalMaze
Free quote

USWDS design tokens explained for Drupal developers

What tokens actually are in USWDS 3

USWDS 3 moved most visual decisions into settings tokens: colors, type scale, spacing units, and radius all resolve through Sass maps in uswds-core. Instead of overriding CSS, you set tokens once and every component inherits the decision. For a Drupal team this maps cleanly onto theme-level settings and SDC props.

The three token layers worth knowing

System tokens are raw values — gray-50, xs, 500. Theme tokens bind those to roles — base-dark, primary, ink. Component tokens tune a single component, like $theme-header-min-height. Customizing the right layer matters: change a theme token to rebrand, touch a component token only when the default genuinely fails.

Setting tokens in a Drupal theme

Your Sass entry typically sets tokens before importing USWDS:

@use "uswds-core" with (
  $theme-font-type-sans: "public-sans",
  $theme-color-primary-darker: "blue-70v",
  $theme-show-notifications: false
);
@forward "uswds";

Compile that into your theme library and the output CSS carries your tokens everywhere — header, buttons, alerts, forms — with no per-component overrides.

Tokens as props in SDC components

When a component needs a variant — say, an alert that can be info, warning, or error — pass the variant as a prop and map it to USWDS classes in Twig, rather than hard-coding modifiers. That keeps your Drupal template honest while USWDS owns the visual vocabulary.

Where teams go wrong

The common failure is bypassing tokens entirely: a developer writes color: #005ea8 in theme CSS because it is faster than finding the token name. Six months later the brand color changes and the site ships a patchwork of literals. Treat tokens like an API: never write a raw color, size, or font outside a token or utility.

Need a second set of eyes on a token architecture? Our Drupal services cover USWDS theming end to end.

Bring us your beautifully complicated problem.

↗