Accordion
Collapse supporting detail so a long page stays scannable. Expand one panel at a time, or several if the content is independent.
Purpose
Best for content most people will skip — FAQs, optional detail. For a single show/hide region use Collapsible.
Example
One panel at a time: type="single" with collapsible, so the open panel can also be closed
again. Without collapsible, one panel must always stay open.
Multiple panels open
When the panels are independent — reference sections a reader may want side by side — use
type="multiple" so opening one does not close another.
GP and specialist visits at panel clinics, up to MYR 1,500 per year.
Scaling, fillings and extractions, up to MYR 800 per year.
Structure
The tokens behind the control.
| Property | Value |
|---|---|
| Item | 1px --border bottom rule |
| Trigger | 14px / Inter 600, 16px vertical padding, hover --primary-strong |
| Chevron | 20px keyboard_arrow_down glyph, --muted-foreground, rotates 180° over 200ms |
| Content | 14px --muted-foreground, 16px bottom padding |
| Motion | height animates open/closed (animate-accordion-down / -up) |
| Focus | 2px --ring on the trigger |
Best practices
Do
- Write triggers as the question or heading the panel answers — scannable without opening.
- Use
type="single" collapsiblefor FAQs, so a reader can close what they opened. - Use
type="multiple"when panels are independent and worth comparing side by side. - Front-load the panels most people come for.
Don't
- Hide content everyone needs — an accordion is for detail most people will skip.
- Nest an accordion inside an accordion panel.
- Use it for a single show/hide region — that is Collapsible's job.
- Put interactive forms behind a panel that
type="single"can close mid-task.
Accessibility & keyboard
- Triggers are buttons carrying
aria-expanded, so state is announced. - Each trigger sits inside a Radix accordion header, keeping the page's heading outline intact.
- The chevron is decorative (
aria-hidden) — state comes fromaria-expanded, not the icon. - Keyboard: Enter or Space toggles a panel; Tab moves between triggers; Up / Down arrows also move between triggers, and Home / End jump to the first and last.
Props
The parts are styled Radix Accordion primitives and accept every Radix prop. On Accordion,
type="single" allows one open panel (add collapsible to let it close again) and
type="multiple" lets panels open independently; control state with defaultValue / value /
onValueChange.