Skip to content

USWDS-Elements: restructure tokens into tier-first directory layout (system/theme/state)#287

Draft
ethangardner wants to merge 3 commits into
developfrom
task/pr-00-tier-first-restructure
Draft

USWDS-Elements: restructure tokens into tier-first directory layout (system/theme/state)#287
ethangardner wants to merge 3 commits into
developfrom
task/pr-00-tier-first-restructure

Conversation

@ethangardner

@ethangardner ethangardner commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates the token source from a flat category-first layout (tokens/{colors,spacing,breakpoints}/) to a tier-first layout. Updates the Style Dictionary config and build helpers to match. No token values change; no published token names change. This does more closely match the documented convention from USWDS' documentation where we have system, theme, and state tokens.

Problem

USWDS's color model has three named layers: system (raw palette), theme (branding roles), and state (feedback roles). The previous flat structure of our tokens didn't reflect this

Solution

The tier-first structure aligns the source layout with USWDS's own published vocabulary and is the prerequisite for all subsequent token work. Other tokens implicitly use the system, theme, state convention as well, even if it is not named as such in the documentation. For example, $theme-modal-lg-max-width is the semantic (theme) alias for the tablet-lg system unit token: https://designsystem.digital.gov/documentation/settings/#configuring-settings-maps.

Major changes

Token source files (moves only, no content changes)

  • tokens/colors/*.json (28 files) → tokens/system/color/*.json
  • tokens/spacing/spacing.jsontokens/system/spacing/spacing.json
  • tokens/breakpoints/breakpoints.jsontokens/system/breakpoints/breakpoints.json
  • Old directories removed
  • Helpers and style dictionary updates and tests

Testing

npm run build:tokens   # exits 0; 6 output files generated
npm run test:ci        # 49 tests, 6 files — all pass

Token name identity check:

grep "usa-color-blue-5:" build/css/system/color.css
# → --usa-color-blue-5: #eff6fb;  (identical to pre-restructure)

@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7edbf3f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ethangardner ethangardner changed the title tokens: restructure into tier-first directory layout (system/theme/state) USWDS-Elements: restructure tokens into tier-first directory layout (system/theme/state) Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant