Skip to content

Components

Accordion

Status
Stable
Accessibility
Reviewed
Package
tenet-ui@0.5.0
Import
import { Accordion } from 'tenet-ui';

When to use: progressively disclosing stacked sections of content (FAQs, settings groups) so the page stays scannable. For switching between peer views use Tabs; for a single show/hide, a lone disclosure button is enough.

  • Compose Accordion.Items, each with a unique value and a title. Each item is a real <button aria-expanded> controlling a labelled region — keyboard and screen-reader support come for free (Enter/Space toggle; Up/Down/Home/End move between headers).
  • Use type="single" (default) when only one section should be open; type="multiple" when several can. Control with value + onValueChange, or uncontrolled with defaultValue.
  • Put the most important section first; don’t bury critical content behind a collapsed header by default.
  • Don’t nest accordions deeply — one level keeps it comprehensible.
  • ✅ <Accordion type="single" defaultValue={['faq-1']}><Accordion.Item value="faq-1" title="…">…</Accordion.Item></Accordion>
  • ❌ A <div onClick> that toggles display with no aria-expanded/region.
  • ❌ Hiding must-see content (errors, primary actions) inside a collapsed item.
2 stories for Accordion, open in Storybook
  • Single components-accordion--single
  • Multiple components-accordion--multiple

The full matrix (all args, controls, accessibility panel) is in Storybook.

Accordion

PropTypeDefaultDescription
type'single' | 'multiple'
AccordionType
singlesingle allows one open item (collapsible); multiple allows many.
valuestring[]NoneControlled set of open item values.
defaultValuestring[][]Uncontrolled initial open item values.
onValueChange(value: string[]) => voidNoneCalled with the new set of open values.
childrenReactNodeNone
classNamestringNone

Accordion.Item

PropTypeDefaultDescription
value *stringNoneUnique value identifying this item.
title *ReactNodeNoneHeader text shown on the trigger button.
disabledbooleanfalseDisable this item.
childrenReactNodeNone
classNamestringNone

* required