I have been utilizing the MUI-Collapse component to display collapsible content within a list. I am looking to add vertical spacing between the Collapse components in the list, but I do not want the spacing to remain when the Collapse is collapsed. I am having difficulty finding an elegant solution for this.
https://i.stack.imgur.com/S26oc.png
Currently, my approach involves setting margin-top on the Collapse component only when it is in its expanded state and applying a transition to that property. However, the transition appears delayed and does not create a smooth animation. Is there a way to include the spacing/margin in the transition animation to achieve a polished effect?
You can view my code sandbox here: https://codesandbox.io/s/stoic-mclaren-csg2wg?file=/src/App.tsx
I would appreciate any suggestions or feedback!