Canvas & Layout
Grids
Nox has two things called a grid. A grid layout is a kind of auto layout: the frame places its children in the cells of columns and rows. A layout grid is a set of guides drawn over a frame to line things up by; it moves nothing. Use the first to build dashboards and galleries, the second to keep a whole screen on one rhythm.

Grid layout#
A grid fills its cells with the frame's children in order, row after row. Columns are equally wide and share the frame's width. Rows are as tall as their tallest child. A child keeps its own size unless its width or height is fill, in which case it takes its cell.
- Select a frame and choose Grid in the inspector's Layout section.
- Set Columns, Gap (between columns), Row gap and Pad.
- Select the children and set W to Fill so each takes its column's width.

Lay the six stat cards out in a grid of three columns, 12 between them, each card as wide as its column.
The agent calls create_nodes (or update_nodes with the same layout on a frame that exists):
{
"nodes": [
{
"kind": "frame", "name": "Stats", "x": 0, "y": 0, "width": 672, "height": "hug",
"layout": {"direction": "grid", "columns": 3, "gap": 12, "row_gap": 12},
"children": [
{"kind": "rectangle", "name": "Revenue", "width": "fill", "height": 72, "corner_radius": 12, "fill": "#FFFFFF"},
{"kind": "rectangle", "name": "Orders", "width": "fill", "height": 72, "corner_radius": 12, "fill": "#FFFFFF"},
{"kind": "rectangle", "name": "Visitors", "width": "fill", "height": 72, "corner_radius": 12, "fill": "#FFFFFF"},
{"kind": "rectangle", "name": "Refunds", "width": "fill", "height": 72, "corner_radius": 12, "fill": "#FFFFFF"},
{"kind": "rectangle", "name": "Carts", "width": "fill", "height": 72, "corner_radius": 12, "fill": "#FFFFFF"},
{"kind": "rectangle", "name": "Reviews", "width": "fill", "height": 72, "corner_radius": 12, "fill": "#FFFFFF"}
]
}
]
}In a grid, align and cross_align place a child in its cell across and down, for children smaller than their cells. If the frame's width hugs, there is no width to share: each column is as wide as its widest child.
Spans, cells, column widths and row heights#

Spans. column_span and row_span on a child say how many columns and rows it lies across. The children after it go round it.
A cell of its own. column and row, counted from 1, put a child in that cell whatever its place among the layers. The others fill the next free cells in their order. null lets it follow its order again.
By hand, select a child of a grid and open Grid Cell in the inspector: Column, Row, Across and Down, and Next Free Cell to let it follow its order.
Column widths. column_widths: [160, 0, 0] gives the first column 160 and lets the other two share what is left. 0 means "share".
Row heights. row_heights: [40, "fill", 32] makes a 40 header, a 32 footer, and a body that takes its content's height and the rest of the frame's height. 0 means "as tall as its content".
The third picture above is this call to create_nodes:
{
"nodes": [
{
"kind": "frame", "name": "Shell", "x": 0, "y": 0, "width": 640, "height": 220, "fill": "#FAFBFC",
"layout": {"direction": "grid", "columns": 3, "gap": 12, "row_gap": 12, "padding": 12, "column_widths": [160, 0, 0], "row_heights": [40, "fill", 32]},
"children": [
{"kind": "rectangle", "name": "Header", "width": "fill", "height": "fill", "column_span": 3, "corner_radius": 10, "fill": "#E4E7EC"},
{"kind": "rectangle", "name": "Sidebar", "width": "fill", "height": "fill", "corner_radius": 10, "fill": "#DCE6FF"},
{"kind": "rectangle", "name": "Content", "width": "fill", "height": "fill", "column_span": 2, "corner_radius": 10, "fill": "#D1FADF"},
{"kind": "rectangle", "name": "Footer", "width": "fill", "height": "fill", "column_span": 3, "corner_radius": 10, "fill": "#E4E7EC"}
]
}
]
}
A child's share, such as "width": "50%", is a share of its cell in a grid, not of the whole frame.
Layout grids as guides#
A layout grid draws columns, rows or squares over a frame. Layers snap to it while you design. It is not drawn in previews or exports, and it does not move anything by itself.
A common web set-up is 12 columns with a 24 gutter and a 32 margin on a 1440 frame; on a 390 phone, 4 columns with a 16 gutter and a 16 margin. An 8-point square grid keeps spacing honest everywhere.
- Select a frame and click Layout Grid in the inspector.
- Choose Add Columns, Add Rows or Add Grid.
- Set Count, Gutter and Margin (or Size for a square grid).
Give the Home frame a 12-column layout grid with a 24 gutter and a 32 margin, and an 8-point square grid.
The agent calls update_nodes with the frame's id:
{"changes": [{"id": "FRAME_ID", "layout_grids": [{"columns": 12, "gutter": 24, "margin": 32}, {"grid": 8}]}]}
null removes them. Leave width out of a column grid and the columns share the frame's width.
For single lines, a frame or a page also takes guides: a list of {"x": 120} (an upright line) or {"y": 64} (a level one).
A grid or a wrapping row#
Both reflow many children. They differ in who decides the width.

| Use | When |
|---|---|
| A grid | Columns must line up: stat cards, a photo gallery, a settings form, a page shell. You choose the number of columns. |
| A wrapping row | Each child has its own width: tags, chips, filters. Or the number across should follow the frame's width: cards with a least width. |
A grid keeps its number of columns when the frame gets narrower; the cells shrink. A wrapping row keeps its children's sizes and changes how many fit on a line. For a card grid that goes from three across to two to one, use a wrapping row with a min_size on the cards, as in Responsive patterns.