Skip to main content

GridLayout

Typeobject
Backlinks1

Grid Layout is a module designed for webpage layout. It allows you to create a two-dimensional grid system, providing flexibility for arranging page elements both horizontally and vertically. By placing elements in the grid's rows and columns, you can easily achieve complex layout structures.

PropertyTypeRequired
classstringRequired
dynamicColumnDynamicColumnRequired
columnWidthColumnWidthRequired
rowHeightRowHeightRequired
baseHeightnumberRequired
columnGapnumberRequired
rowGapnumberRequired
gridAutoFlowintegerRequired
paddingArray<number>Required
cellAlignAlignmentRequired

class​

Required

Type

string

Value

constant: the value of this property must be equal to:

"gridLayout"

dynamicColumn​

Required

Description

no description

columnWidth​

Required

Description

no description

rowHeight​

Required

Description

no description

baseHeight​

Required

Description

When there are empty rows or row height cyclic dependencies within the grid container, this value is used as a reference value. To avoid this issue, it is generally recommended that you explicitly set the height of subgrids or elements in the grid layout, either by using fixed heights or automatic heights to avoid height cyclic dependencies.

Type

number

columnGap​

Required

Description

This property sets the size of the gap (gutter) between an element's columns. This property accepts values in pixels (px) as units.

Type

number

rowGap​

Required

Description

This property sets the size of the gap (gutter) between an element's rows. This property accepts values in pixels (px) as units.

Type

number

gridAutoFlow​

Required

Description

This property used to set the automatic placement behavior of items in a grid layout. This property defines how items are automatically placed within the grid container when their position is not explicitly specified.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
1
row: Items are placed in order from left to right and top to bottom.
2
row dense: The purpose of this value is to fill the empty spaces in the grid container as much as possible, even if it means that the order of grid items may change.

padding​

Required

Description

This property is used to set the inner spacing for grid containers and grid items, increasing the space between them and around their content. You can adjust the value of padding as needed. This property accepts values in pixels (px) as units.

Type

Array<number>

Value

maximum number of items: the maximum number of items for this array is: 4

minimum number of items: the minimum number of items for this array is: 4

cellAlign​

Required

Description

This property uniformly controls the horizontal alignment of all subgrids within the grid container. It takes effect when the sum of the column widths of the subgrids is less than the width of the grid container. By default, the subgrids align at the start position, but you can adjust their horizontal position within the grid container.