Accordion
The :::accordion directive groups collapsible panels together. Each panel is an ::accordion-item with its own #heading slot and body content.
Basic usage
::accordion
:::accordion-item
#heading
### How do I file a FOIA request?
#body
Visit the FOIA portal at foia.gov...
:::
:::accordion-item
#heading
### What is the response timeline?
#body
Agencies have 20 business days...
:::
::Bordered + multiselectable
Pass bordered for the USWDS bordered variant, and multiselectable to let users open more than one panel at a time. Pass expanded on individual items to start them open.
Multi-paragraph content works inside accordion items.
Lists, bold, code, and other markdown render normally:
- Step one
- Step two
- Step three
::accordion{bordered multiselectable}
:::accordion-item{expanded}
#heading
### Eligibility
#body
This item is open by default...
:::
::Deep linking
Headings inside accordion content get automatic anchor IDs from github-slugger. When the URL's hash matches a heading inside a collapsed panel, the panel expands automatically and the page scrolls to that heading.
Try these links — they'll open the accordion below and scroll to the target:
Fee schedule (1)
Most simple requests are processed at no cost. Complex requests may incur fees for search, review, and duplication:
| Category | Rate |
|---|---|
| Search | $33/hour |
| Review | $55/hour |
| Duplication | $0.10/page |
Expedited processing (1)
You may qualify for expedited processing if you can demonstrate a compelling need, such as an imminent threat to life or safety.
Props reference
Accordion
| Prop | Type | Default |
|---|---|---|
bordered | boolean | false |
multiselectable | boolean | false |
AccordionItem
| Prop | Type | Default |
|---|---|---|
expanded | boolean | false |
#heading slot | markdown | — |
#body / body | markdown | — |
Behavior notes
- The
#headingslot becomes the clickable<button>inside USWDS's.usa-accordion__headingwrapper. - Semantic heading level comes from the markdown you write inside
#heading—### Fookeeps an<h3>in the document outline, and the TOC picks it up. multiselectablemaps to USWDS'sdata-allow-multipleattribute, which the USWDS JS reads to decide whether to auto-collapse siblings.- Deep-link hash expansion is handled client-side by the
accordion-hashutility, which runs on page load and onhashchange.
Source
Component: packages/astro/src/components/Accordion.tsx