Skip to main content
Container is type of control that dictates the layout of other controls. The containers logic only affects direct child controls. Containers usually arrange child controls every frame by collecting their desired size via .Measure() and then providing them with the size that they can afford via .Arrange(). After calculation of the desired and afforded sizes of its children, the container can override the child components coordinates if needed. This document only covers some of the most commonly used containers. Additions expanding it with others are welcome.
This page is a stub and complete descriptions of how containers will react to new items being added, overflow, the subtleties with GridContainer etc. are not convered.

BoxContainer

BoxContainer is the most straightforward layout control. It lays out its children sequentially in a certain Orientation, either vertically or horizontally. Controls do not overlap.
FieldTypeEffective Default ValueDescription
OrientationLayoutOrientationHorizontalWhether to arrange the elements horizontally or vertically.
AlignAlignModeBeginThe alignment of the children along the orientation axis.
SeparationOverrideint0The separation between elements.

GridContainer

GridContainer lays out its children in a configurable grid.
FieldTypeEffective Default ValueDescription
ColumnsintThe number of columns to organize the children into.
RowsintThe number of rows to organize the children into.
MaxGridWidthfloatThe maximum width of the grid of elements, and dynamically determines the number of columns based on the size of the elements.
MaxGridHeightfloatThe maximum height of the grid, and dynamically determines the number of rows based on the size of the elements
VSeparationOverrideint0The vertical separation between elements.
HSeparationOverrideint0The horizontal separation between elements.
ExpandBackwardsboolfalseWhether to expand the grid backwards, i.e. from the bottom-right to the top-left.

ScrollContainer

ScrollContainer is a container that shows a cropped view of its children, with optional scrolling either vertically, horizontally, or both.
FieldTypeEffective Default ValueDescription
FallbackDeltaScrollbooltrueIf true, a vertical scroll will be translated into a horizontal scroll if vertical scrolling is not possible.
ScrollSpeedXint50The scroll speed in the x-direction.
ScrollSpeedYint50The scroll speed in the y-direction.
ReserveScrollbarSpaceboolfalseWhether the scrollbar will take up space in the layout
VScrollEnabledbooltrueWhether vertical scrolling is enabled.
HScrollEnabledbooltrueWhether horizontal scrolling is enabled.

LayoutContainer

LayoutContainer helps in complicated layouts by allowing its children to specify how they should be laid out.
FieldTypeEffective Default ValueDescription
AnchorBeginfloat0The value of an anchor that is at the beginning of the layout.
AnchorEndfloat1The value of an anchor that is at the end of the layout.
InheritChildMeasurebooltrueIf true, measurements of this control will be at least the size of any contained controls.
Then children of the LayoutContainer may use to following fields to control their layout:
FieldType
MarginLeftfloat
MarginTopfloat
MarginRightfloat
MarginBottomfloat
AnchorLeftfloat
AnchorTopfloat
AnchorRightfloat
AnchorBottomfloat
GrowHorizontalbool
GrowVerticalbool
Last modified on June 20, 2026