<GridLayout> is a layout container that lets you arrange its child elements in a table-like manner.

The grid consists of rows, columns, and cells. A cell can span one or more rows and one or more columns. It can contain multiple child elements which can span over multiple rows and columns, and even overlap each other.

By default, <GridLayout> has one column and one row. You can add columns and rows by configuring the columns and the rows properties. In these properties, you need to set the number of columns and rows and their width and height. You set the number of columns by listing their widths, separated by a comma. You set the number of rows by listing their heights, separated by a comma.

You can set a fixed size for column width and row height or you can create them in a responsive manner:

An absolute number: Indicates a fixed size.

auto: Makes the column as wide as its widest child or makes the row as tall as its tallest child.

*: Takes as much space as available after filling all auto and fixed size columns or rows.

Props

Name

Type

Description

columns

String

A string value representing column widths delimited with commas.Valid values: an absolute number, auto, or *.A number indicates an absolute column width. auto makes the column as wide as its widest child. * makes the column occupy all available horizontal space. The space is proportionally divided over all star-sized columns. You can set values such as 3* and 5* to indicate a ratio of 3:5 in sizes.

rows

String

A string value representing row heights delimited with commas.Valid values: an absolute number, auto, or *.A number indicates an absolute row height. auto makes the row as tall as its tallest child. * makes the row occupy all available vertical space. The space is proportionally divided over all star-sized rows. You can set values such as 3* and 5* to indicate a ratio of 3:5 in sizes.

Additional children props

When an element is a direct child of <GridLayout>, you can work with the following additional properties.

Name

Type

Description

row

Number

Specifies the row for this element. Combined with a col property, specifies the cell coordinates of the element.The first row is indicated by 0.

col

Number

Specifies the column for the element. Combined with a row property, specifies the cell coordinates of the element.The first column is indicated by 0.