Accordion
A set of collapsible panels with headings.
API reference
Import the component and assemble its parts:
import { Accordion } from '@base-ui-components/react/accordion';
<Accordion.Root>
<Accordion.Item>
<Accordion.Header>
<Accordion.Trigger />
</Accordion.Header>
<Accordion.Panel />
</Accordion.Item>
</Accordion.Root>Root
Groups all parts of the accordion.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
defaultValue |
|
| |
value |
|
| |
onValueChange |
|
| |
hiddenUntilFound |
|
| |
openMultiple |
|
| |
disabled |
|
| |
loop |
|
| |
orientation |
|
| |
className |
|
| |
keepMounted |
|
| |
render |
|
|
| Attribute | Description | |
|---|---|---|
data-orientation | Indicates the orientation of the accordion. | |
data-disabled | Present when the accordion is disabled. | |
Item
Groups an accordion header with the corresponding panel.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
onOpenChange |
|
| |
disabled |
|
| |
className |
|
| |
render |
|
|
| Attribute | Description | |
|---|---|---|
data-open | Present when the accordion item is open. | |
data-disabled | Present when the accordion item is disabled. | |
data-index | Indicates the index of the accordion item. | |
Header
A heading that labels the corresponding panel.
Renders an <h3> element.
| Prop | Type | Default | |
|---|---|---|---|
className |
|
| |
render |
|
|
| Attribute | Description | |
|---|---|---|
data-open | Present when the accordion item is open. | |
data-disabled | Present when the accordion item is disabled. | |
data-index | Indicates the index of the accordion item. | |
Trigger
A button that opens and closes the corresponding panel.
Renders a <button> element.
| Prop | Type | Default | |
|---|---|---|---|
className |
|
| |
render |
|
|
| Attribute | Description | |
|---|---|---|
data-panel-open | Present when the accordion panel is open. | |
data-disabled | Present when the accordion item is disabled. | |
Panel
A collapsible panel with the accordion item contents.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
hiddenUntilFound |
|
| |
className |
|
| |
keepMounted |
|
| |
render |
|
|
| Attribute | Description | |
|---|---|---|
data-open | Present when the accordion panel is open. | |
data-orientation | Indicates the orientation of the accordion. | |
data-disabled | Present when the accordion item is disabled. | |
data-index | Indicates the index of the accordion item. | |
data-starting-style | Present when the panel is animating in. | |
data-ending-style | Present when the panel is animating out. | |
| CSS Variable | Description | |
|---|---|---|
--accordion-panel-height | The accordion panel's height. | |
--accordion-panel-width | The accordion panel's width. | |