Skip to content
nexubDesign System
v12.7.0

Components · Motion

Collapse

StableAdded v0.0.1

Expands and collapses content along the block axis.

import { Collapse } from '@nexub/react';
View as Markdown

Playground

Props

Collapsed content goes here.

TSX
<Collapse in>…</Collapse>

Examples

Default

Collapsed content goes here.

Toggle

This content collapses and expands smoothly.

Props

Props
PropTypeDefaultDescription
inrequiredboolean—When true, expands the content to its natural height. When false, collapses it to zero height.
duration'instant' | 'fast' | 'normal' | 'slow' | 'slower''normal'Controls the animation speed using the design token scale.
unmountOnExitbooleanfalseRemoves the element from the DOM after the collapse animation completes.
asReact.ElementType<any, keyof React.JSX.IntrinsicElements>'div'The HTML element or component to render as the wrapper.
childrenReact.ReactNode—Content to expand and collapse.
collapsedHeightstring | number0Starting height when collapsed. Useful for "peek" effects.

On iOS & Android