My response above contains a link to the Tree documentation. Though, for a visual reference, that’s the control that’s used in the Godot editor for the Scene Tree and the FileSystem panel.
It provides the expand / collapse feature that you mention, though depending on your requirements, it may not be what you need…
I copy the example code and it doesn’t work, as it would with a label