Layout & display
Accordion
Stack collapsible sections. Each <AccordionItem> is a details element, so the browser opens and closes it and an accordion works on a page that runs no script. Only
one item opens at a time unless you pass multiple to <Accordion>.
Single open
The items share a name, so when you open one the browser closes the one that was
open. The title is plain text, never a heading, because a heading inside a summary breaks several
screen readers. Put a heading above the accordion to name the group:
Shipping and returns
When will my order ship?
What's the returns policy?
Can I order in custom sizes?
Multiple open
With multiple the items share no name, and each one opens and closes on its own.
Section A
Section B
Section C
Flush variant
Use flush when the accordion sits inside another bordered surface, such as a Card or a
Drawer. It drops the outer border and the corner radius:
Tighter framing
Just dividers
Finding an item
An item's id is the id of its details element, so it must be unique on
the page. A link can point at it, and a script finds the item by it and reads its open property to know whether it is open. The browser reports each item's state to a screen reader itself,
so the item carries no aria-expanded and its body no region role.
The shared name counts from the start of each server render. If you put a page together from
several renders, give each render its own idPrefix, or two accordions on the page
share a name and opening an item in one closes the other's.
API · Accordion
| Prop | Type | Default | Description |
|---|---|---|---|
multiple | boolean | false | Allow more than one item open at a time. The items then share no name. |
flush | boolean | false | Drop the outer border + radius (for embedding). |
class | string | no default | Extra classes on the wrapper. |
children required | Snippet | no default | AccordionItem instances. |
API · AccordionItem
| Prop | Type | Default | Description |
|---|---|---|---|
id required | string | no default | The id of the item's details element. Unique on the page. |
title required | string | no default | Plain text shown in the item's summary. Never a heading. |
class | string | no default | Extra classes on the details element. |
children required | Snippet | no default | Panel content. |