Sajari UI

Collapse

The Collapse component is used to create regions of content that can expand/collapse with a simple animation. It helps to hide content that's not immediately relevant to the user.

This component leverages react-animate-height, and composes the Box component.

Usage

Basic Usage

Editable Example

Changing the startingHeight

This demo also shows how it can be combined with the truncate prop of the Text component.

Editable Example

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.

Props

This component doesn't have any custom props.

NameTypeDescription
openbooleanIf true, the content will be visible
animateOpacitybooleanIf true, the opacity of the content will be animated
durationnumberThe animation duration as it expands
startingHeightnumberThe height you want the content in it's collapsed state. Set to 0 by default
endingHeightnumberThe height you want the content in it's expanded state. Set to auto by default
onAnimationEndfuncThe function to be called when the collapse animation starts. It provides the currentHeight as an argument
onAnimationStartfuncThe function to be called when the collapse animation ends. It provides the currentHeight as an argument