- Android
- iOS
- Web
Accordion
An Accordion component is a UI element that allows users to expand and collapse sections of content. It is commonly used to organize information in a compact and accessible manner, displaying only the headers by default and revealing the associated content when clicked. This helps improve the readability of complex or lengthy information by reducing clutter on the page.
Example.tsx
| Name | Type | Default | Details |
|---|---|---|---|
| items | readonly T[] | Required | Panels with a title, message, and optional id and disabled flag. |
| type | "single" | "multiple" | Optional | How many panels can be open at once. Default: single. |
| defaultExpanded | boolean | Optional | Open the first enabled panel initially when expansion is uncontrolled. |
| expanded | boolean | Optional | Control whether any panel is open. Opening selects the first enabled panel if no selection is saved. |
| onExpandedChange | ((expanded: boolean) => void) | Optional | Called when a user action opens the first panel or closes the last one. |
| variant | "default" | "surface" | Optional | Surface gives each panel its own background and border. Default: default. |
| className | string | Optional | |
| itemClassName | string | Optional | |
| triggerClassName | string | Optional | |
| contentClassName | string | Optional | |
| indicatorClassName | string | Optional |