Accordion
A set of collapsible panels with headings.
Features
- Full keyboard navigation support
- Supports single or multiple expanded panels
- Supports horizontal and vertical orientations
Installation
typo3 ui:add accordion
Please copy the files manually from GitHub into your project.
Read more about installing Components and Primitives.
Examples
Multiple Expanded Panels
Allow multiple accordion items to be expanded at once by setting multiple to true.
Disabled Items
Disable specific accordion items to prevent interaction.
API Reference
The following tables cover the available props of the Fluid Primitives. For a full list of available client side props and methods, see the Zag.js Machine API.
accordion.root
Groups all parts of the accordion. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
multiple | booleanWhether multiple accordion items can be expanded at the same time. | No | false |
collapsible | booleanWhether an accordion item can be closed after it has been expanded. | No | true |
defaultValue | string[]The initial value of the expanded accordion items. Use when you don't need to control the value of the accordion. | No | - |
disabled | booleanWhether the accordion items are disabled. | No | - |
orientation | Enum\OrientationThe orientation of the accordion items. | No | Vertical |
accordion.item
Groups an accordion header with the corresponding content. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
value | stringThe value of the accordion item. | Yes | - |
disabled | booleanWhether the accordion item is disabled. | No | - |
accordion.itemHeader
A heading that labels the corresponding content. Renders an <h3> element.
| Name | Description | Required | Default |
|---|---|---|---|
level | integerThe heading level to render for the accordion item header. | No | 3 |
accordion.itemContent
The content of the accordion item. Renders a <div> element.
accordion.itemTrigger
A button that opens and closes the corresponding item. Renders a <button> element.
accordion.itemIndicator
An optional visual indicator that can be used to show the open/closed state of the item. Renders a <div> element.
Anatomy
<primitives:accordion.root>
<primitives:accordion.item>
<primitives:accordion.itemHeader>
<primitives:accordion.itemTrigger>
<primitives:accordion.itemIndicator />
</primitives:accordion.itemTrigger>
</primitives:accordion.itemHeader>
<primitives:accordion.itemContent />
</primitives:accordion.item>
</primitives:accordion.root>