Accordion

A set of collapsible panels with headings.

API reference

Import the component and assemble its parts:

Anatomy
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.

PropTypeDefault
defaultValue

array

undefined

value

array

undefined

onValueChange

(value) => void

undefined

hiddenUntilFound

boolean

false

openMultiple

boolean

true

disabled

boolean

false

loop

boolean

true

orientation

'horizontal' | 'vertical'

'vertical'

className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-disabled

Item

Groups an accordion header with the corresponding panel. Renders a <div> element.

PropTypeDefault
onOpenChange

(open) => void

undefined

disabled

boolean

false

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-disabled
data-index

A heading that labels the corresponding panel. Renders an <h3> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-disabled
data-index

Trigger

A button that opens and closes the corresponding panel. Renders a <button> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-panel-open
data-disabled

Panel

A collapsible panel with the accordion item contents. Renders a <div> element.

PropTypeDefault
hiddenUntilFound

boolean

false

className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-disabled
data-index
data-starting-style
data-ending-style
CSS Variable
Description
--accordion-panel-height
--accordion-panel-width