Accordion with free style children

I asked my question on this forum but not sure if anyone is watching it so i will try here.

I want to achieve the accordion effect with different sections in a large form.
The above linked forum has exactly what i want… except it does not work for me with free styling children!
By this i mean, I was hoping i could add a cell on the grid that would contain a less constrained mix of buttons, labels and input boxes. If i do this, it will not collapse however.

Using the downloadable script, could you tell me how i would add, for example, a button that is 40x40 units large when expanded then disappears to show only the heading when closed?

Thanks in advance to anyone who can help me with this.

Update: Worth mentioning that i originally planned to pin each section to its sibling above. That way if the above sibling is expanded it will push the below sibling down. However this only works with parent-child relationships. I would have a massively deep hierarchy if i put each section inside another section all the way down - not pretty.

So these are 4.6 UI elements you’re talking about? Every aspect of these elements are script-able to achieve what you’re asking for. I made something similar to that video by having buttons (label strips) which cause their child to activate or deactivate. The child contains all the elements as sub-children. Child groups can be dynamically created through prefabs and code, or built in the inspector. If the whole system is built such that each element group and toggle / label strip are children of the same object, and you make liberal use of the Layout elements and their properties, you can mimic what is seen in that video and expand upon it as you describe.