Collapsible
moleculeExpandable/collapsible content section with a trigger. Smooth height animation via direct DOM measurement (180ms), CSS-driven hover feedback with translucent tint, focus-visible ring, disabled state, and padded prop to control content spacing. Auto-bleeds inside Card by consuming CardPaddingContext — just wrap in a Card and it works. Dynamic overflow (hidden during animation, visible when resting) so nested shadows aren't clipped. Supports controlled and uncontrolled open state.
Uncontrolled
Self-managed open state with defaultOpen.
Default open
Starts in the expanded state.
Disabled
Prevents toggling with reduced opacity and not-allowed cursor.
Usage
Installation
API Reference
Collapsible props — * required
| Prop | Type | Default | Description |
|---|---|---|---|
trigger* | React.ReactNode | — | The always-visible trigger element (string or JSX). |
children* | React.ReactNode | — | Content shown when expanded. |
defaultOpen | boolean | false | Uncontrolled initial open state. |
open | boolean | — | Controlled open state. |
onOpenChange | (open: boolean) => void | — | Called when open state changes. |
disabled | boolean | false | Reduces trigger opacity to 0.5, sets cursor: not-allowed, and prevents toggling. |
padded | boolean | true | When false, removes built-in content padding so children (e.g. a nested Card) can provide their own spacing. |
style | React.CSSProperties | — | Inline styles for the wrapper. |