Accordion
A vertically stacked set of collapsible items with animated expand/collapse transitions and support for single or multi-item expansion.
Accordion renders a vertical list of AccordionItemData entries. Each item has a tappable header with a rotating chevron and an animated content panel that fades and expands into view. By default multiple items can be open simultaneously; set singleItemExpand = true to allow only one open item at a time.
Basic usage
API reference
Accordion
| Parameter | Type | Default | Description |
|---|---|---|---|
items | List<AccordionItemData> | — | Ordered list of sections to render. |
modifier | Modifier | Modifier | Applied to the root Column container. |
defaultOpenItemId | String? | null | ID of the item to expand on first composition. |
singleItemExpand | Boolean | false | When true, opening an item collapses any currently open item. |
AccordionItemData
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier used to track expanded state. |
header | @Composable () -> Unit | Content rendered inside the tappable header row. |
content | @Composable () -> Unit | Content revealed when the item is expanded. |