Skip to main content
DrupalMaze
Free quote

Extending USWDS safely: overrides, forks, and SDC wrappers

Option 1: tokens and utilities (use 90% of the time)

Most "custom" needs are actually token needs. Before writing any CSS, check whether a theme token or utility class already expresses the change — colors, spacing, type, radius, border width all have tokens. This path survives every USWDS upgrade because you never touched compiled output.

Option 2: the SDC wrapper (the Drupal answer)

When a component needs different structure — an extra region, a variant USWDS does not ship — wrap it in a Single Directory Component with your own Twig. Inside, you still render USWDS classes where they apply, adding only the delta. The wrapper owns markup; USWDS still owns styling. Upgrades keep working because your class names are the same ones USWDS styles.

Option 3: the fork (use deliberately)

Copying a USWDS Sass component into your theme and editing it is sometimes correct — when the change is structural and upstream will never take it. But a fork freezes that component at today's version: accessibility fixes shipped in USWDS 3.2 will not reach it. Fork consciously, document why, and put the forked file where a future maintainer will notice it.

What "unsafe" looks like

The anti-pattern is deep CSS overrides: .usa-card .usa-card__container { border-radius: 12px !important }. It works until an upgrade renames a class or adds a sub-element, and then the site silently loses styles in places nobody tests. If you find yourself writing descendant selectors against USWDS internals, you are past the safe line.

A decision rule

Token first, wrapper second, fork last — and always prefer expressing variants as props over expressing them as CSS. That is the approach we bring to USWDS implementations: the goal is a site that upgrades with USWDS, not against it.

Bring us your beautifully complicated problem.

↗