Collapse
The Collapse component is use 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#
Editable Example
Props#
This component doesn't have any custom props.
Name | Type | Description |
---|---|---|
isOpen | boolean | If true , the content will be visible |
animateOpacity | boolean | If true , the opacity of the content will be animated |
duration | number | The animation duration as it expands |
startingHeight | number | The height you want the content in it's collapsed state. Set to 0 by default |
endingHeight | number | The height you want the content in it's expanded state. Set to auto by default |
onAnimationEnd | func | The function to be called when the collapse animation starts. It provides the currentHeight as an argument |
onAnimationStart | func | The function to be called when the collapse animation ends. It provides the currentHeight as an argument |