Skip to content

Collapsible

A compound component that expands and collapses a content section behind a toggle button.

Collapsible toggles the visibility of a content section behind a rotating chevron button. Unlike Accordion, it’s a compound component: Collapsible provides the expanded state, and you compose Collapsible.Button and Collapsible.Content yourself inside it. This is the building block Workflow Builder uses for the expand/collapse control on its node panels - see NodePanel for that composition.

import { Collapsible } from '@workflowbuilder/ui';
function Example() {
return (
<Collapsible defaultExpanded>
<Collapsible.Button />
<Collapsible.Content>Additional details go here.</Collapsible.Content>
</Collapsible>
);
}

Collapsible.Button and Collapsible.Content read the expanded state from context, so both must be rendered inside a Collapsible.

PartPropsDescription
Collapsiblesee PropsState provider. Controlled via isExpanded + onToggle, or uncontrolled via defaultExpanded.
Collapsible.ButtonnoneToggle button rendered as a rotating chevron. Reads and flips the expanded state.
Collapsible.ContentchildrenContent wrapper. Animates its height between collapsed and expanded.
childrenrequired
TypeReactNode
collapseLabel
Typestring
Default'Collapse'

Accessible label for the button when the content is expanded

defaultExpanded
Typeboolean
expandLabel
Typestring
Default'Expand'

Accessible label for the button when the content is collapsed

isExpanded
Typeboolean
onToggle
Type(expanded: boolean) => void

Size

--wb-public-collapsible-transition-duration