Collapse

Components/Mechanisms

Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/collapse

Overview

Copy

Collapse makes content collapsible. Wrap content in <Collapse/> to show and hide it with an animation, or use it to build accordions.

Do

  • Use it to show and hide content that users open on demand, such as advanced settings.
  • Connect it to a visible control, such as a button or toggle, that opens and closes it.

Don't

  • Don't build a list of collapsible sections from scratch. Use <Accordion/> instead.
  • Don't hide content that users must read to complete a task.

Code

Copy

Props

NameTypeDefaultDescription
childrenReactNode—Content to render inside the collapse.
dataHookstring—Adds a data-hook attribute for testing purposes.
mountOnEnterbooleantrueDelays 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.
openbooleantrueDetermines whether the collapse is open.
position"static" | "sticky"staticDetermines if the collapse stays fixed at the top of its container.
unmountOnExitbooleantrueUnmounts the component after it finishes exiting. If false, the component stays mounted after exit.

Testkit

Import the driver matching your test environment:

Copy

Driver methods

MethodDescription
isOpenChecks whether the component is expanded and the content is visible
existsChecks whether the component found with the given data hook.
elementGets the component root element.
clickClicks on the component root element.
baseReturns UniDriver for the base element.

Changelog

  • 1.340.0 (2026-10-21) — maintenance release, no component-specific changes
  • 1.339.0 (2026-10-19) — maintenance release, no component-specific changes
  • 1.338.0 (2026-10-15) — maintenance release, no component-specific changes
  • 1.320.0 (2026-09-03) — maintenance release, no component-specific changes
  • 1.310.0 (2026-08-10) — maintenance release, no component-specific changes
  • 1.292.0 (2026-06-22) — maintenance release, no component-specific changes
  • 1.267.0 (2026-04-09) — maintenance release, no component-specific changes
  • 1.266.0 (2026-04-07) — maintenance release, no component-specific changes
  • 1.260.0 (2026-03-17) — maintenance release, no component-specific changes
  • 1.254.0 (2026-02-03) — maintenance release, no component-specific changes
  • 1.144.0 (2024-12-03) — feat: position (#14342)
  • 1.116.0 (2024-07-22) — maintenance release, no component-specific changes
  • 1.93.0 (2024-02-08) — maintenance release, no component-specific changes
  • 1.92.1 (2024-02-05) — maintenance release, no component-specific changes

Last updated: 22 October 2026

Did this help?