Why componentize at all
Government pages are assembled by editors, not developers. If a content editor can paste a USWDS alert into a WYSIWYG, they can also break its markup — missing roles, wrong heading levels, stray classes. Wrapping components in Drupal Single Directory Components (SDC) turns "remember the markup" into "pick a variant and fill the fields".
The pattern: SDC in front, USWDS behind
Each component gets a component.yml declaring props that mirror the USWDS variant surface — type, slim, noIcon for alerts; color and href for buttons. The Twig template maps props to USWDS classes verbatim:
<div class="usa-alert usa-alert--{{ type }}{% if slim %} usa-alert--slim{% endif %}" role="alert">
<div class="usa-alert__body">
<h4 class="usa-alert__heading">{{ heading }}</h4>
<p class="usa-alert__text">{{ text }}</p>
</div>
</div>The USWDS class names never leave the component. Editors and even other templates only see the prop contract.
Field wiring that survives content edits
Map paragraph or block fields to props one-to-one. Resist the urge to pass raw HTML — let the component own markup and accept only text, URLs, and variant enums. That discipline is what keeps a hundred pages accessible two editors later.
Nesting without surprises
USWDS relies on a grid (grid-container, grid-row, grid-col). Decide once whether each SDC brings its own container or expects the layout to provide it — mixing the two produces double-padding bugs that look like a CSS problem but are really an architecture ambiguity.
What it buys you
Accessibility stays intact because roles, aria attributes, and heading structure live in the component, not in editorial free text. Rebrands become a token change, not a content migration. And new components get reviewed once in Storybook instead of QA'd page by page. See how this plays out in a real build in our USWDS theme walkthrough.