Accordion
Stacked sections that expand to reveal their content.
- Status
- Ready
- Code
- In React
- Role
- Display
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
How long does a transfer take?
What are the limits?
Pastes as editable layers. Shadows are not exported.
import { Accordion, type AccordionItem } from "@/ui";
const items: AccordionItem[] = [
{ title: "How long does a transfer take?", content: "Most transfers arrive within a minute.", defaultOpen: true },
{ title: "What are the limits?", content: "Limits depend on your account type." },
];
export default function AccordionDemo() {
return <Accordion items={items} />;
}Variants and states
Every specimen is the real component from src/ui, held in one state.
These specimens are inert, so each one stays in the state it is labeled with.
What are the limits?
What are the limits?
Can I send money to an account at another bank, and how long does that transfer take to arrive?
Pastes as editable layers. Shadows are not exported.
Props
- items
- AccordionItem[] · default none
- One entry per section, in order.
- items[].title
- string · default none
- The header text. It is also the React key, so titles must be unique within one accordion.
- items[].content
- ReactNode · default none
- What shows when the item is open.
- items[].defaultOpen
- boolean · default none
- Opens the item on first render. After that, the browser keeps the open state.
- className
- string · default ""
- Extra classes for the outer container. Accordion takes no other attributes, so there is no ...rest.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🖍 Label
- items[].title
- Closest match: the header text of each item.
- 📝 Description
- items[].content
- Closest match: the body of each item. In code it can hold any content, not only text.
- 🎯 State
- items[].defaultOpen
- Open or closed on first render only. After that, the state is runtime.
- ☘️ Icon
- None
- No prop yet. The caret icon is fixed.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Each header is a native summary element. Tab moves between headers, and Enter or Space opens or closes one.
- Items are independent. Opening one does not close the others.
- Links and fields inside a closed item cannot be reached with Tab until the item is opened.
- This component draws no focus indicator of its own. On this site a global :focus-visible rule draws a 2px outline in the border/focus role (--color-role-border-focus). Copy the role tokens and that rule, or an equivalent, into your app.
Screen readers
- Browsers expose each header as an expandable control with its open or closed state. The exact wording depends on the browser and screen reader.
- The content of a closed item is hidden from screen readers.
- Headers are not headings, so they do not appear in a screen reader's list of headings. The caret icon is aria-hidden.
What you still need to do
- Give every item a unique title.
- If the headers need to be in the page's heading outline, Accordion does not support that yet.
When to use
Long reference content, where people look for one section at a time.
Do and don't
Do
- Write headers that describe what is inside.
- Let the whole header row toggle the section.
Don't
- Hide the only important content in a collapsed section.
- Nest accordions inside accordions.
Related
4 of 28 other molecules, same role and ready ones first.
- CardA container that groups related content and actions.Ready
- DividerA thin line used to separate content into distinct sections.Ready
- Empty StateCommunicates that there is no content to show, with a next step.Ready
- QR Code DisplayA scannable code with its amount, recipient, and expiry.Ready
Status reflects the component tracker snapshot of 29 October 2026.