Skip to main content

gridAutoTracks

Applicable only on auto-layout frames with layoutMode set to "GRID". Controls how the grid handles automatic row creation.

Signature

gridAutoTracks: 'NONE' | 'ROWS'

Remarks

  • "NONE" (default): the row count is controlled by gridRowCount, but will never go below the number of rows necessary to hold all children in the grid.
  • "ROWS": new rows are added automatically as children are appended, and removed when a row becomes empty. Setting gridRowCount directly will throw an error while this is set to "ROWS".
Grid with automatic rows
const grid = figma.createFrame()
grid.layoutMode = 'GRID'
grid.gridColumnCount = 3
grid.gridAutoTracks = 'ROWS'

// The grid starts with 1 row and 3 columns.
// Appending more children than the grid can fit
// automatically adds new rows.
for (let i = 0; i < 7; i++) {
grid.appendChild(figma.createFrame())
}
// + --- + --- + --- +
// | 1 | 2 | 3 |
// + --- + --- + --- +
// | 4 | 5 | 6 |
// + --- + --- + --- +
// | 7 | | |
// + --- + --- + --- +
grid.gridRowCount // 3 (auto-managed)