Components/Mechanisms
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/collapse
Collapse makes content collapsible. Wrap content in <Collapse/> to show and hide it with an animation, or use it to build accordions.
<Accordion/> instead.| Name | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Content to render inside the collapse. |
dataHook | string | — | Adds a data-hook attribute for testing purposes. |
mountOnEnter | boolean | true | Delays mounting the component until it is displayed. If false, the component mounts immediately. If true, it mounts on first display. |
onCollapseAnimationEnd | (animationTiming?: AnimationTiming | undefined) => void | — | Triggered when the collapse animation completes. |
onExpandAnimationEnd | (animationTiming?: AnimationTiming | undefined) => void | — | Triggered when the expand animation completes. |
open | boolean | true | Determines whether the collapse is open. |
position | "static" | "sticky" | static | Determines if the collapse stays fixed at the top of its container. |
unmountOnExit | boolean | true | Unmounts the component after it finishes exiting. If false, the component stays mounted after exit. |
Import the driver matching your test environment:
| Method | Description |
|---|---|
isOpen | Checks whether the component is expanded and the content is visible |
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
click | Clicks on the component root element. |
base | Returns UniDriver for the base element. |
Last updated: 22 October 2026