Skip to content
GitHub (opens in a new tab)

Accordion

Disclosure list for short related sections: one open at a time, or several with type multiple.

stableMoleculecontracts/accordion.json

Preview

Accordion

Disclosure list for short related sections.

Master

One item open at a time by default. Down and Up move between headers, Right opens, Left closes.

Weekdays 9–5. Closed on public holidays.
Knez Mihailova 1, Belgrade.
Street parking in front of the studio. Garage one block north.

Usage

Use for FAQ or short settings groups. Use Tabs for peer views. Use DocsNav for the sidebar.

Do's

  • FAQ or help copy grouped under short titles
  • Settings or detail blocks the user opens one at a time, or several side by side with type multiple

Don'ts

  • In-page peer views — use Tabs
  • Sidebar catalog groups — use DocsNav
  • A single show/hide block — use Collapsible
  • Page grouping under a heading — use Section (collapsible if it folds)
<Accordion
  defaultOpen="hours"
  items={[
    { id: "hours", title: "Hours", content: "Weekdays 9–5." },
    { id: "address", title: "Address", content: "Knez Mihailova 1." },
  ]}
/>

When to use

  • FAQ or help copy grouped under short titles
  • Settings or detail blocks the user opens one at a time, or several side by side with type multiple

When not to use

  • In-page peer views — use Tabs
  • Sidebar catalog groups — use DocsNav
  • A single show/hide block — use Collapsible
  • Page grouping under a heading — use Section (collapsible if it folds)

What an agent reads

import { Accordion } from "agentic-ds-kit";
must
  • Each header is a button with aria-expanded
  • Button aria-controls the matching panel
  • Panel is role=region, aria-labelledby its header
  • Closed panels are hidden from AT
  • Down and Up move focus between headers (Home and End jump to the ends); Right opens, Left closes
  • Disabled items set aria-disabled, cannot toggle, and are skipped by Tab and arrow keys
  • Panels glide open on the enter motion timing and fold on exit, with a fade and light blur on the body; the chevron turns with the panel. No motion under prefers-reduced-motion
defaults
  • type single
stops if
  • Do not invent local Accordion or Collapse — use Collapsible for one block
  • Do not use raw hex

From contracts/accordion.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
itemsarrayYes—content is the panel body: a string or kit pieces such as a Field or Table. meta is short secondary text at the end of the header. count renders a neutral kit Count at the end of the header, before meta. disabled shows the header but it cannot toggle. Header: md control height (36); ChevronRight 16px first, turning down when open; 14/20 title at 550; Count then meta grouped at the end. The body lines up with the title.
typesingle | multipleNosinglesingle keeps one item open; opening another closes it. multiple lets any number stay open.
defaultOpenstring | string[]No—Item id (or ids with type multiple) that start open. Omit to start all closed. With type single only the first id opens.
  • Component
    →

    Tabs

    Switch between related views in place.

  • Component
    →

    DocsNav

    Docs and catalog sidebar only: title, grouped text-only links, optional decorative icons and muted counts on group and subgroup headers only, an active page pill and optional footer links.

  • Component
    →

    Collapsible

    Single show/hide panel.

  • Component
    →

    Section

    Grouped page block with optional heading, description, and actions.