Accordion

A set of collapsible panels with headings.

API reference

Import the component and assemble its parts:

Anatomy

Root

Groups all parts of the accordion. Renders a <div> element.

PropTypeDefault
defaultValue

any[]

undefined

value

any[]

undefined

onValueChange

((value: any[]) => void)

undefined

hiddenUntilFound

boolean

false

openMultiple

boolean

true

disabled

boolean

false

loop

boolean

true

orientation

AccordionOrientation

'vertical'

className

string | ((state: State) => string)

undefined

keepMounted

boolean

false

render

| ReactElement
| ((props: GenericHTMLProps, state: State) => ReactElement)

undefined

Attribute
Description
data-orientation
data-disabled

Item

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

PropTypeDefault
value

any

undefined

onOpenChange

((open: boolean) => void)

undefined

disabled

boolean

false

className

string | ((state: State) => string)

undefined

render

| ReactElement
| ((props: GenericHTMLProps, state: State) => 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: State) => string)

undefined

render

| ReactElement
| ((props: GenericHTMLProps, state: State) => 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: State) => string)

undefined

render

| ReactElement
| ((props: GenericHTMLProps, state: State) => 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: State) => string)

undefined

keepMounted

boolean

false

render

| ReactElement
| ((props: GenericHTMLProps, state: State) => ReactElement)

undefined

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