Component library

Accessible by construction

Five interaction patterns built to the WAI-ARIA Authoring Practices. Every widget below is fully operable with a keyboard, keeps its ARIA state in sync with what you see, and announces changes to assistive technology. Unplug your mouse and try them.

Tabs

role="tablist"

Only the selected tab is in the tab order — arrows move between tabs and activate them, and panels that are not shown carry the hidden attribute rather than being merely pushed off-screen.

What the pattern is made of

Three parts, all of them labelled: the trigger, the surface it controls, and the state that links them.

  • The trigger carries aria-expanded so the state is readable without sight.
  • The controlled region is referenced by aria-controls, which must resolve.
  • Hover, focus and selected styles are deliberately distinct.

←→ switch tabs · Home/End first / last · Tab enters the open panel

Combobox

aria-activedescendant

An editable text field with a filtered listbox. The input keeps and owns DOM focus; the highlighted option is communicated with aria-activedescendant, so the listbox itself is never focusable.

28 matches

Type to filter · ↓↑ move the highlight · Enter accepts · Esc reverts and closes

Accordion

disclosure group

Independent disclosures — several may be open at once. Regions animate on height, and hidden is only applied once the closing animation has finished, so assistive technology never sees a half-collapsed region.

Copy the primitives you need. There is no runtime dependency: each component is a single behavioural module plus its stylesheet layer.

Nothing is fetched at runtime, so the library works in air-gapped builds, offline docs and print stylesheets alike.

Tab to a header · Enter / Space toggles · multiple panels may stay open

Keyboard contract

The short version, if you only remember one line per component:

  • Dialog — Tab is trapped · Esc closes · focus returns to the trigger.
  • Menu — ↓ opens and focuses the first item · ↑↓ wrap · Esc closes and refocuses the button.
  • Tabs — one tab stop · ←→ activate · hidden panels are hidden.
  • Combobox — typing filters · ↑↓ moves aria-activedescendant · Esc reverts.
  • Accordion — Enter/Space toggles · height animates · hidden lands at the end.