The Accordion component lets users show and hide sections of related content on a page. It supports both single and multiple expanded items (also called Disclosure).
variant
isDisabled
allowsMultipleExpanded
1<Accordion>
2 <Accordion.Item>
3 <Accordion.Trigger>
4 What are your shipping options?
5 </Accordion.Trigger>
6 <Accordion.Content>
7 We offer standard (5-7 days), express (2-3 days), and overnight shipping. Free shipping on international orders.
8 </Accordion.Content>
9 </Accordion.Item>
10 <Accordion.Item>
11 <Accordion.Trigger>
12 What are your shipping options?
13 </Accordion.Trigger>
14 <Accordion.Content>
15 We offer standard (5-7 days), express (2-3 days), and overnight shipping. Free shipping on international orders.
16 </Accordion.Content>
17 </Accordion.Item>
18</Accordion>1<Accordion>
2 <Accordion.Item>
3 <Accordion.Trigger></Accordion.Trigger>
4 <Accordion.Content></Accordion.Content>
5 </Accordion.Item>
6</Accordion>npm install @rootui/accordion1'use client'
2
3import { Accordion } from "@rootui/accordion";
4
5export default function Page() {
6 return (
7 <Accordion>
8 <Accordion.Item>
9 <Accordion.Trigger>Header here</Accordion.Trigger>
10 <Accordion.Trigger>Content here</Accordion.Trigger>
11 </Accordion.Item>
12 </Accordion>
13 )
14}See the React Aria documentation for more information.
Prop | Type | Default |
|---|---|---|
| | |
| | |
Whether multiple items can be expanded at the same time. | ||
| | |
Handler that is called when items are expanded or collapsed. | ||
| | |
Whether all items are disabled. | ||
| | |
The currently expanded keys in the group (controlled). | ||
| | |
The initial expanded keys in the group (uncontrolled). | ||
| | |
Attribute | Description |
|---|---|
| Whether the accordion is disabled. |
Prop | Type | Default |
|---|---|---|
| | |
Whether the accordion item is disabled. | ||
| | |
Whether the accordion item is expanded (controlled). | ||
| | |
Whether the accordion item is expanded by default (uncontrolled). | ||
| | |
An id for the disclosure when used within a DisclosureGroup, matching the id used in expandedKeys. | ||
Attribute | Description |
|---|---|
| Whether the accordion item is expanded. |
| Whether the accordion item has keyboard focus. |
| Whether the accordion item is disabled. |
Prop | Type | Default |
|---|---|---|
| | |
The children of the component. | ||
Prop | Type | Default |
|---|---|---|
| | |
The children of the component. | ||
| | |
The HTML element used to render the label, e.g. 'label', or 'span'. | ||
Attribute | Description |
|---|---|
| Whether keyboard focus is within the accordion content. |
CSS variable | Description |
|---|---|
| The accordion content's intrinsic width in pixels. Useful for animations. |
| The accordion content's intrinsic height in pixels. Useful for animations. |