SlideDown
Expand or collapse an element with a height transition
import SlideDown from "@intility/bifrost-react/SlideDown";Animate height
Animating height is tricky because CSS can't transition to keyword auto,
this component creates two wrapper divs which use the
.bf-expand class.
This component is used internally by <Accordion.Item>,
<Message expandable>, <Table.Row content>,
and <Nav.Group> (when inside expanded sidebar or mobile menu).
Pass a boolean to the open prop to control its open/collapsed state:
<SlideDown open={booleanState}>
<p>My content...</p>
</SlideDown>Combined with <Button.Expand> you can create
expandable content like this;
Padding
The technique used
internally
does not allow padding on the wrapper element.
Avoid padding on the <SlideDown> itself
<SlideDown open={booleanState} style={{ padding: "16px" }}>
<p>Will not be hidden properly :(</p>
</SlideDown>Instead apply padding to a container around your content
<SlideDown open={booleanState}>
<div style={{ padding: "16px" }}>
<p>Ahh, that's much better</p>
</div>
</SlideDown>