Skip to main content

A set of collapsible panels with headings.

We offer worldwide shipping with various delivery options to suit your needs. Orders are processed within 24 hours and typically arrive within 5-10 business days.

Features

Installation

typo3 ui:add accordion

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.

NameDescriptionRequiredDefault
multipleboolean
Whether multiple accordion items can be expanded at the same time.
No
false
collapsibleboolean
Whether an accordion item can be closed after it has been expanded.
No
true
defaultValuestring[]
The initial value of the expanded accordion items. Use when you don't need to control the value of the accordion.
No
-
disabledboolean
Whether the accordion items are disabled.
No
-
orientationEnum\Orientation
The orientation of the accordion items.
No
Vertical
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
rootIdstring
The root ID of the component, used for hydration and identification.
No
-
idsarray
The IDs of of the component parts for composition.
No
[]
controlledboolean
If true, the component is meant to be initialized manually inside another component
No
false
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Rendered data attributes

AttributeDescription
data-scopeaccordion
data-partroot
data-orientationThe orientation of the accordion

accordion.item

Groups an accordion header with the corresponding content. Renders a <div> element.

NameDescriptionRequiredDefault
valuestring
The value of the accordion item.
Yes
-
disabledboolean
Whether the accordion item is disabled.
No
-
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Rendered data attributes

AttributeDescription
data-scopeaccordion
data-partitem
data-state"open" | "closed"
data-focusPresent when focused
data-disabledPresent when disabled
data-orientationThe orientation of the item

accordion.itemHeader

A heading that labels the corresponding content. Renders an <h3> element.

NameDescriptionRequiredDefault
levelinteger
The heading level to render for the accordion item header.
No
3
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

accordion.itemContent

The content of the accordion item. Renders a <div> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Rendered data attributes

AttributeDescription
data-scopeaccordion
data-partitem-content
data-state"open" | "closed"
data-disabledPresent when disabled
data-focusPresent when focused
data-orientationThe orientation of the item

accordion.itemTrigger

A button that opens and closes the corresponding item. Renders a <button> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Rendered data attributes

AttributeDescription
data-scopeaccordion
data-partitem-trigger
data-controls
data-orientationThe orientation of the item
data-state"open" | "closed"
data-focusPresent when focused

accordion.itemIndicator

An optional visual indicator that can be used to show the open/closed state of the item. Renders a <div> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Rendered data attributes

AttributeDescription
data-scopeaccordion
data-partitem-indicator
data-state"open" | "closed"
data-disabledPresent when disabled
data-focusPresent when focused
data-orientationThe orientation of the item

Machine JavaScript API

NameTypeDescription
focusedValuestring | nullThe value of the focused accordion item.
valuestring[]The value of the accordion
setValue(value: string[]) => voidSets the value of the accordion
getItemState(props: ItemProps) => ItemStateReturns the state of an accordion item.

Accessibility

KeyDescription
SpaceWhen focus is on an trigger of a collapsed item, the item is expanded
EnterWhen focus is on an trigger of a collapsed section, expands the section.
TabMoves focus to the next focusable element
Shift + TabMoves focus to the previous focusable element
ArrowDownMoves focus to the next trigger
ArrowUpMoves focus to the previous trigger.
HomeWhen focus is on an trigger, moves focus to the first trigger.
EndWhen focus is on an trigger, moves focus to the last trigger.

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>