Skip to content
NativeScript Unified

NativeScript views

GridLayout

<GridLayout> places children into a grid of rows and columns, and maps to CSS grid on the web.

AttributeOnMeaning
rowsGridLayoutComma-separated row tracks. Default is one * row.
columnsGridLayoutComma-separated column tracks. Default is one * column.
row, colchildZero-based cell. Default 0.
rowspan, colspanchildCells to span. row-span and col-span also work.

Track values: auto, * (one 1fr), 2* (2fr), a bare number (pixels), or a number with px, %, dip or fr.

Header (row 0, spans 2)
Side
Content
Footer

HTML-first equivalent

The polyfill maps to CSS grid, so write the grid yourself. rows="auto, *, auto" becomes grid-rows-[auto_1fr_auto], columns="80, *" becomes grid-cols-[80px_1fr], and colspan="2" becomes col-span-2. Children flow into cells in order, so row and col are rarely needed:

Header
Side
Content
Footer