GridLayout
GridLayout
places elements on a grid.
GridLayout
covers its entire surface with cells. Cells are not aligned.
The elements constituting the cells will be stretched inside their allocated
space, unless their size constraints—like, e.g., min-height
or
max-width
—work against this.
Spacing Properties
spacing
length default: 0px
The distance between the elements in the layout. This single value is applied to both horizontal and vertical spacing.
To target specific axis with different values use the following properties:
spacing-horizontal
length default: 0px
spacing-vertical
length default: 0px
Padding Properties
padding
length default: 0px
The padding around the grid structure as a whole. This single value is applied to all sides.
To target specific sides with different values use the following properties:
padding-left
length default: 0px
padding-right
length default: 0px
padding-top
length default: 0px
padding-bottom
length default: 0px
Cell elements
Cell elements inside a GridLayout
obtain the following new properties. Any bindings to these properties must be compile-time constants:
row
int default: 0
The index of the element’s row within the grid. Setting this property resets the element’s column to zero, unless explicitly set.
col
int default: 0
The index of the element’s column within the grid. Set this property to override the sequential column assignment (e.g., to skip a column).
rowspan
int default: 1
The number of rows this element should span.
colspan
int default: 1
The number of columns this element should span.
To implicitly sequentially assign row indices—just like with col
—wrap cell elements in Row
elements.
The following example creates a 2-by-2 grid with Row
elements, omitting one cell:
The following example creates the same grid using the row
property. Row indices must be taken care of manually:
© 2024 SixtyFPS GmbH