Skip to main content

Collapsible

A collapsible panel controlled by a button.

Features

Installation

typo3 ui:add collapsible

Read more about installing Components and Primitives.

Examples

Default Open

Set the collapsible to be open by default.

alien-bean-pasta

wild-irish-burrito

horse-battery-staple

Disabled

Prevent the collapsible from being toggled.

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.

collapsible.root

Provides the collapsible state and wraps the trigger and content. Renders a <div> element.

NameDescriptionRequiredDefault
defaultOpenboolean
The initial open state of the collapsible when rendered. Use when you don't need to control the open state of the collapsible.
No
false
disabledboolean
Whether the collapsible is disabled.
No
-
collapsedHeightstring
The height of the content when collapsed.
No
-
collapsedWidthstring
The width of the content when collapsed.
No
-

collapsible.trigger

Toggles the collapsible open and closed. Renders a <button> element.

collapsible.indicator

Displays state-specific content inside the trigger. Use state="open" and state="closed". Renders a <span> element.

NameDescriptionRequiredDefault
stateEnum\CollapsibleIndicatorState
The indicator state to render.
Yes
-

collapsible.content

Contains the collapsible content region. Renders a <div> element.

Anatomy

<primitives:collapsible.root>
    <primitives:collapsible.trigger>
        <primitives:collapsible.indicator state="closed" />
        <primitives:collapsible.indicator state="open" />
    </primitives:collapsible.trigger>
    <primitives:collapsible.content />
</primitives:collapsible.root>