Components · Motion
Collapse
StableAdded v0.0.1
Expands and collapses content along the block axis.
import { Collapse } from '@nexub/react';Playground
Props
Collapsed content goes here.
<Collapse in>…</Collapse>Examples
Default
Toggle
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| inrequired | boolean | — | 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. |
| unmountOnExit | boolean | false | Removes the element from the DOM after the collapse animation completes. |
| as | React.ElementType<any, keyof React.JSX.IntrinsicElements> | 'div' | The HTML element or component to render as the wrapper. |
| children | React.ReactNode | — | Content to expand and collapse. |
| collapsedHeight | string | number | 0 | Starting height when collapsed. Useful for "peek" effects. |
On iOS & Android
Web only
Collapse has no @nexub/react-native twin. On phones, follow the platform pattern instead, or compose it from the native components listed on the React Native page.