nkbt / react-collapse

Component-wrapper for collapse animation with react-motion for elements with variable (and dynamic) height
MIT License
1.13k stars 113 forks source link

Add class when expanded #218

Closed CaptObvious closed 5 years ago

CaptObvious commented 6 years ago

For styling reasons, is it possible to add a class to the ReactCollapse--collapse div when expanded? This would help with placing borders around the expanded box that aren't there when it's collapsed.

Olliebaba commented 6 years ago

@CaptObvious - You could toggle a class name stored in the parent's state using onRest. It might be weird though since borders impact layout. Why not just put the border on the child component that's hidden?

nkbt commented 5 years ago

Please use onRest for this sort of things, it should work well in a new react-collapse@5.0.0 https://github.com/nkbt/react-collapse/releases/tag/v5.0.0