Accordion
Stacked expandable sections with animated panels.
Installation
Usage
Examples
Single open panel
Only one item stays open at a time. Opening another closes the first.
Multiple open panels
Pass multiple to keep more than one item open at a time.
Disabled item
Items accept disabled to lock them closed.
API reference
Accordion
| Prop | Type | Default |
|---|---|---|
defaultValueInitially expanded item values (uncontrolled). | string[] | - |
valueControlled expanded item values. Use with onValueChange. | string[] | - |
onValueChangeCalled when an item is expanded or collapsed. | (value: string[]) => void | - |
multipleAllow more than one item to stay open at a time. | boolean | false |
disabledIgnore user interaction across the whole accordion. | boolean | false |
orientationControls whether roving focus uses left/right or up/down arrow keys. | "horizontal" | "vertical" | "vertical" |
loopFocusLoop keyboard focus back to the first item at the end of the list. | boolean | true |
keepMountedKeep panel content in the DOM while closed. | boolean | false |
hiddenUntilFoundHide closed panels with hidden="until-found" so browser find can expand them. | boolean | false |
AccordionItem
| Prop | Type | Default |
|---|---|---|
valueUnique identifier for the item. If omitted, an ID is generated automatically: set it to preselect or control the item via value / defaultValue. | string | - |
disabledLock this item closed. | boolean | false |
onOpenChangeCalled when this item's panel opens or closes. | (open: boolean) => void | - |
AccordionTrigger
| Prop | Type | Default |
|---|---|---|
renderPolymorphic render prop. Use to render a custom element instead of the default button. | ReactElement | ((props) => ReactNode) | - |
classNameAdditional classes merged with the default trigger styles. | string | - |
disabledDisable this trigger. Inherits the native button disabled behavior. | boolean | false |
AccordionContent
| Prop | Type | Default |
|---|---|---|
renderPolymorphic render prop. Use to render a custom element instead of the default panel div. | ReactElement | ((props) => ReactNode) | - |
classNameAdditional classes merged with the default panel styles. | string | - |
keepMountedKeep the panel content in the DOM while closed. | boolean | false |
hiddenUntilFoundHide the closed panel with hidden="until-found" so browser find can expand it. | boolean | false |