set_layout
Set auto-layout properties on a container: control spacing, padding, direction, alignment, or grid layout for its children.
Instructions
Set auto-layout properties on a container.
set_layout({node: "1:2", gap: 16, p: 24}) set_layout({node: "1:2", layout: "row", justify: "space-between"}) set_layout({node: "1:2", layout: "column", gap: 8, p: "16 24", align: "center"}) set_layout({node: "1:2", layout: "grid", cols: 3, rows: 2, gap: 16})
// Batch — bulk update in one call: set_layout({nodes: [{node: "1:2", gap: 16, p: 24}, {node: "1:3", gap: 8, p: 12}]})
Controls spacing, padding, direction, and alignment of a container's children. Grid: use layout:"grid" with cols/rows + gap (or rowGap/colGap for asymmetric). Children fill the grid in insertion order.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| node | No | Node ID (single mode) | |
| layout | No | Auto-layout mode | |
| gap | No | Spacing between children (px). On grid sets both row+column gap. | |
| rowGap | No | Grid row gap (px, grid only) | |
| colGap | No | Grid column gap (px, grid only) | |
| cols | No | Grid column count (required when layout="grid") | |
| rows | No | Grid row count (required when layout="grid") | |
| p | No | Padding — number, "v h", or "t r b l" | |
| justify | No | Main axis (flex only) | |
| align | No | Cross axis (flex only) | |
| wrap | No | Wrap behaviour (flex only) | |
| nodes | No | Batch: [{node, layout?, gap?, p?, ...}] |