U.S. flagA digital services project by Flexion

Language Selector

navigationUSWDS-derivedinteractive

Language switcher with two-language toggle and multi-language dropdown modes.

Reference: USWDS documentation ↗

Variants

Multi Language

Two Language

Contract

Class mapping

USWDSFlexNotes
usa-language-container<flex-language-selector> (custom element)Container element
usa-button (language trigger).flex-language-selector__buttonButton to toggle language menu
usa-language__submenu.flex-language-selector__menuDropdown menu with language options
usa-language__submenu-item a.flex-language-selector__linkIndividual language link
usa-language (two-language)flex-language-selector[data-variant="two"]Two-language variant (simple link, no dropdown)

Verified properties

displayfont-sizeposition

Intentional differences

color: ours = var(--flex-blue-vivid-60), USWDS = #005ea2

We use a semantic token for primary link color; USWDS uses the exact primary value

font-size: ours = 0.87rem, USWDS = 16px (default)

Two-language variant uses compact sizing matching USWDS --small variant

font-weight: ours = 700, USWDS = 400

Two-language variant uses bold to emphasize the language toggle link

text-decoration: ours = none, USWDS = underline

We remove underline for cleaner appearance; underline appears on hover

display: ours = block, USWDS = inline

Block display gives consistent click target sizing within the flex container

Behavior promises

  • ✓ Button click toggles menu visibility and aria-expanded
  • ✓ Outside click closes menu
  • ✓ Escape key closes menu and returns focus to button
  • ✓ Two-language variant renders as simple link (no JS)

Source CSS