How to line up controls vertically?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sprowk

I tried all green nodes godot can offer but could not figure this out.
I am trying to vertically line up control nodes, for example labels so they do not occupy more space than they need to. I will need it to react in real time if I add another labels or buttons.

Which nodes, flags or something else should do it?

example image

On the left is what I want.
On the right is when it occupies more space.

:bust_in_silhouette: Reply From: Gabrii

A VBoxContainer might be what you need. Additionally, you can change its “separation” under Custom constants to 0 and activate the constant with the left checkbox.

It will resize automatically when you add or remove nodes.

On a side note, if you see your controls shrink to a very small size, you have to give them a minimum size (because the current size becomes controlled by the VBoxContainer).

Zylann | 2018-04-17 18:00

thank you both. Indeed had a problem with shrinking and minimum size worked nicely.

Sprowk | 2018-04-18 19:23