Accordion

A set of collapsible panels with headings.

API reference

Import the component and place its parts the following way:

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
classNamestring | (state) => stringundefined
defaultValuearrayundefined
disabledbooleanfalse
hiddenUntilFoundbooleanfalse
keepMountedbooleanfalse
loopbooleantrue
onValueChange(value) => voidundefined
openMultiplebooleantrue
orientation'horizontal' | 'vertical''vertical'
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
valuearrayundefined
Attribute
Description
data-disabled

Item

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

PropTypeDefault
classNamestring | (state) => stringundefined
disabledbooleanfalse
onOpenChange(open) => voidundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-disabled
data-index
data-open

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

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-disabled
data-index
data-open

Trigger

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

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-disabled
data-panel-open

Panel

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

PropTypeDefault
classNamestring | (state) => stringundefined
hiddenUntilFoundbooleanfalse
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-disabled
data-ending-style
data-index
data-open
data-starting-style
CSS Variable
Description
--accordion-panel-height
--accordion-panel-width