Skip to main content

gridRowCount

Applicable only on auto-layout frames with layoutMode set to "GRID". Determines the number of rows in the grid.

Signature

gridRowCount: number

Remarks

If the setter for this value is called on a grid with a value less than 1, it will throw an error. Users cannot remove rows from a grid if they are occupied by children, so if you try to reduce the count of rows in a grid and some of those rows have children, it will throw an error. By default, when the row count is increased, the new rows will be added as GridTrackSize objects with type "FLEX". If you want to change the type of the new rows, you can use the setters on GridTrackSize objects returned by gridRowSizes or gridColumnSizes.

Grid layout with 2 rows and 3 columns
const parentFrame = figma.createFrame()
parentFrame.layoutMode = 'GRID'
parentFrame.gridRowCount = 2
parentFrame.gridColumnCount = 3

// Grid frame with 2 rows and 3 columns
// + --- + --- + --- +
// | | | |
// + --- + --- + --- +
// | | | |
// + --- + --- + --- +