Skip to main content
AnimatedExpandableContainer animates the height or width of its content. The application owns its expanded state and trigger. There is no uncontrolled mode or built-in toggle.

Anatomy

children and isExpanded are required. The component supplies the collapsible root and animated panel internally. Supply the trigger separately and keep its aria-expanded value synchronized with isExpanded.

Usage

Animation and content lifetime

The default dimension is height. Use dimension="width" for horizontal expansion. containAnimation defaults to true, clips overflow, and lays content out in a column. Turn it off when content needs to overflow during the transition. Use duration for a theme timing preset (instant, fast, normal, or slow). animationDurations={{ opacity: 0.15, size: 0.25 }} supplies independent durations in seconds and takes precedence over the preset. The panel unmounts its content after closing. Keep state that must survive closing outside the panel. The component does not forward native attributes or refs to its internal panel; keep focus handling and trigger relationships in the application. mode and initial remain in the accepted prop type but currently have no effect.

Props

AnimationDurations
default:"default"
Default theme timing or separate opacity and size durations in seconds.
ReactNode
required
Content inside the expanding panel.
boolean
default:"true"
Clips overflowing content during expansion and uses a column layout.
"height" | "width"
default:"height"
Dimension animated when the panel opens and closes.
"fast" | "instant" | "normal" | "slow"
Theme timing preset for both opacity and size. Explicit animationDurations take precedence.
boolean
Compatibility prop accepted by the type but not used by the current implementation.
boolean
required
Controlled visibility of the panel. The application owns the trigger and state.
"fit-content" | "scroll-height"
Compatibility prop accepted by the type but not used by the current implementation.