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.

<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>
typo3 ui:add accordion

Read more about installing Components and Primitives.

Set multiple to keep several panels open at once. Try opening two items below.

Set disabled on an accordion.item to keep its panel closed. The second item below is disabled.

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.

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
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
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
[]
autoMountboolean
Whether the client initializes the component on its own. Set it to false to mount it yourself with `mount()`
No
true
classstring
The CSS class(es) to be applied to the component.
No
-

Rendered data attributes

AttributeDescription
data-accordion-root<uid>
data-orientationThe orientation of the accordion

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
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
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
-

Rendered data attributes

AttributeDescription
data-accordion-item<uid>
data-state"open" | "closed"
data-focusPresent when focused
data-disabledPresent when disabled
data-orientationThe orientation of the item

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
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
classstring
The CSS class(es) to be applied to the component.
No
-

Rendered data attributes

AttributeDescription
data-accordion-item-header<uid>
data-state"open" | "closed"
data-focusPresent when focused
data-disabledPresent when disabled
data-orientationThe orientation of the item

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

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
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
-

Rendered data attributes

AttributeDescription
data-accordion-item-content<uid>
data-state"open" | "closed"
data-disabledPresent when disabled
data-focusPresent when focused
data-orientationThe orientation of the item

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

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
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
-

Rendered data attributes

AttributeDescription
data-accordion-item-trigger<uid>
data-controls
data-orientationThe orientation of the item
data-state"open" | "closed"
data-focusPresent when focused

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

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
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
-

Rendered data attributes

AttributeDescription
data-accordion-item-indicator<uid>
data-state"open" | "closed"
data-disabledPresent when disabled
data-focusPresent when focused
data-orientationThe orientation of the item
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.
getItemHeaderProps(props: ItemProps) => T["element"]Returns props for the item heading wrapper around the trigger. Render this as a heading element (e.g. `h3`) per the WAI-ARIA accordion pattern.
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.