U.S. flagA digital services project by Flexion

Accordion

layoutUSWDS-derivedinteractive

An expandable/collapsible content section, borderless or bordered.

Reference: USWDS documentation ↗

Variants

Bordered Accordion

Second section content.

Default Accordion

No Soldier shall, in time of peace...

Multiselectable Accordion

First section content.

Second section content.

Contract

Class mapping

USWDSFlexNotes
usa-accordion<flex-accordion> (custom element)Container element
usa-accordion__heading.flex-accordion__headingSection heading wrapper
usa-accordion__button.flex-accordion__buttonToggle button
usa-accordion__content.flex-accordion__contentCollapsible panel
data-allow-multipledata-multiselectableAllow multiple panels open simultaneously

Verified properties

background-colorfont-sizefont-weightfont-familyline-heightcursor

Intentional differences

display: ours = flex, USWDS = inline-block

We use flex for space-between layout with +/- indicator; USWDS uses inline-block with background image

Behavior promises

  • ✓ Click button expands content
  • ✓ Click again collapses content
  • ✓ Default mode: opening one closes others
  • ✓ Multiselectable: multiple can be open
  • ✓ Keyboard Enter toggles accordion
  • ✓ Hover state background matches USWDS
  • ✓ Accessibility audit passes with mixed states

Source CSS