Components · Motion
Collapse
StableSince v0.0.1
Expands and collapses content along the block axis.
import { Collapse } from '@nexub/react';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. |
| easing | 'linear' | 'in' | 'out' | 'in-out' | 'out-expo' | 'spring' | 'out' | Easing curve applied to the animation. |
| unmountOnExit | boolean | false | Removes the element from the DOM after the collapse animation completes. |
| as | React.ElementType | 'div' | The HTML element or component to render as the wrapper. |
| childrenrequired | React.ReactNode | — | Content to expand and collapse. |
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.