You can just use groupboxes in Mendix 5 they give you the collapsing functionality that you require.
https://world.mendix.com/display/refguide5/Group+box
If you were previously selecting a page in Mendix 4 you can replace this with snippets inside the groupbox.
You could try the CollapseGroupbox Widget: https://appstore.home.mendix.com/link/app/1588/Synobsys/CollapseGroupBoxWidget
That one is for Mx5 and seems to do kind of the same.
Regards,
Ronald