
Vertically collapsible content panels with smooth height animations.
npx shadcn@latest add https://ui.edbn.me/r/accordion.jsonGroups all parts of the accordion. Renders a div element.
valueValue[]Controlled values of the expanded items
defaultValueValue[]Initial values of the expanded items
onValueChange(value, eventDetails) => voidCalled when an item is expanded or collapsed
multiplebooleanfalseAllow multiple items to be open
disabledbooleanfalseIgnore user interaction for the whole accordion
orientation'vertical' | 'horizontal''vertical'Controls visual orientation and arrow-key direction
loopFocusbooleantrueLoop arrow-key focus from the last item to the first
hiddenUntilFoundbooleanfalseKeep closed panel content findable with hidden='until-found'
keepMountedbooleanfalseKeep closed panels in the DOM; ignored when hiddenUntilFound is enabled
classNamestring | ((state) => string)Class name or state-based class callback
styleCSSProperties | ((state) => CSSProperties)Style object or state-based style callback
renderReactElement | ((props, state) => ReactElement)Replace or compose the rendered element
| Attribute | Description |
|---|---|
| data-disabled | Present when the accordion is disabled |
| data-orientation | Accordion orientation |
Groups an accordion header with the corresponding panel. Renders a div element.
valueanyauto-generatedUnique value that identifies this item
disabledbooleanfalseDisable this item
onOpenChange(open, eventDetails) => voidCalled when this item opens or closes
classNamestring | ((state) => string)Class name or state-based class callback
styleCSSProperties | ((state) => CSSProperties)Style object or state-based style callback
renderReactElement | ((props, state) => ReactElement)Replace or compose the rendered element
| Attribute | Description |
|---|---|
| data-index | Index of the accordion item |
| data-disabled | Present when the item is disabled |
| data-open | Present when the item is open |
A heading that labels the corresponding panel. Renders an h3 element.
classNamestring | ((state) => string)Class name or state-based class callback
styleCSSProperties | ((state) => CSSProperties)Style object or state-based style callback
renderReactElement | ((props, state) => ReactElement)Replace or compose the rendered heading
| Attribute | Description |
|---|---|
| data-index | Index of the accordion item |
| data-disabled | Present when the item is disabled |
| data-open | Present when the item is open |
A button that opens and closes the corresponding panel. Renders a button element.
nativeButtonbooleantrueSet false when the render prop replaces the button with a non-button element
classNamestring | ((state) => string)Class name or state-based class callback
styleCSSProperties | ((state) => CSSProperties)Style object or state-based style callback
renderReactElement | ((props, state) => ReactElement)Replace or compose the rendered button
| Attribute | Description |
|---|---|
| data-panel-open | Present when the panel is open |
| data-disabled | Present when the item is disabled |
A collapsible panel with the accordion item contents. Renders a div element.
hiddenUntilFoundbooleanfalseKeep closed content findable with hidden='until-found'
keepMountedbooleanfalseKeep this panel in the DOM while closed; ignored when hiddenUntilFound is enabled
classNamestring | ((state) => string)Class name or state-based class callback
styleCSSProperties | ((state) => CSSProperties)Style object or state-based style callback
renderReactElement | ((props, state) => ReactElement)Replace or compose the rendered panel
| Attribute | Description |
|---|---|
| data-index | Index of the accordion item |
| data-open | Present when the panel is open |
| data-orientation | Accordion orientation |
| data-disabled | Present when the item is disabled |
| data-starting-style | Present when the panel is animating in |
| data-ending-style | Present when the panel is animating out |
| Variable | Description |
|---|---|
| --accordion-panel-height | Measured natural panel height |
| --accordion-panel-width | Measured natural panel width |