UI Layout Containers¶
Pite provides Godot-style UI layout containers that automatically position and size Control children (Label, Button, and nested containers) using a top-left origin (position is the top-left corner of the rect).
Control Layout Properties¶
Every Control node (Label, Button, and all containers) exposes:
size: Vec2: Computed or authored width and height in world units.custom_minimum_size: Vec2: Minimum size enforced by parent containers (default(0.0, 0.0)).size_flags_horizontal: str/size_flags_vertical: str: Sizing policy inside a parent container:"fill"(default): Fill the assigned slot."expand": Claim extra space along the container's main axis."expand_fill": Claim extra space and expand to fill the slot."shrink_begin"/"shrink_center"/"shrink_end": Keep minimum size and align within the slot.
Container Nodes¶
All container nodes inherit from the abstract Container base (Control → Container):
| Node | Purpose | Key Properties |
|---|---|---|
HBoxContainer |
Arranges children horizontally left-to-right | spacing, alignment ("begin", "center", "end") |
VBoxContainer |
Arranges children vertically top-to-bottom | spacing, alignment ("begin", "center", "end") |
CenterContainer |
Centers children within its bounding rect | use_top_left (bool) |
HFlowContainer |
Flows children horizontally, wrapping onto new rows | h_separation, v_separation, alignment |
VFlowContainer |
Flows children vertically, wrapping onto new columns | h_separation, v_separation, alignment |
GridContainer |
Arranges children in a fixed-column grid | columns, h_separation, v_separation |
MarginContainer |
Adds outer padding around children | margin_left, margin_top, margin_right, margin_bottom |
ScrollContainer |
Clips children to its rect and offsets by scroll position | scroll_horizontal, scroll_vertical, horizontal_scroll_mode, vertical_scroll_mode |