figma_set_layout
Configure a Figma frame's auto layout or grid layout and place child nodes in one call using gaps, padding, alignment, sizing, and grid tracks.
Instructions
Set a frame's auto layout or grid layout in one call, and place its children. Auto layout: mode HORIZONTAL or VERTICAL, gap, padding, primaryAlign (MIN, CENTER, MAX, SPACE_BETWEEN, SPACE_EVENLY, SPACE_AROUND), counterAlign, wrap with counterAxisGap and alignContent, and sizing (FIXED, HUG, FILL). Grid: mode GRID with tracks written CSS-style (grid.columns: '240px 1fr 1fr', 'repeat(3, 1fr)', 'auto 1fr', or a count), gaps, autoRows, autoFlow, and per-child row, column, spans and alignment. Only the fields you pass change. Returns the resulting layout, with grid tracks as CSS. Requires Desktop Bridge.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"nodeId": "<nodeId>"
},
"name": "figma_set_layout"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gap | No | Space between items. On a grid, sets both row and column gaps | |
| grid | No | ||
| mode | No | ||
| wrap | No | Wrap children onto new lines (HORIZONTAL or VERTICAL) | |
| width | No | ||
| height | No | ||
| nodeId | Yes | Frame, component or instance to lay out | |
| fileKey | No | Local Mode only. Run against this specific connected file instead of the active file. Get connected fileKeys from figma_list_open_files. Rejected in Cloud Mode, which pairs with a single plugin instance. | |
| padding | No | One number for all sides, or {top, right, bottom, left} | |
| children | No | ||
| alignContent | No | How wrapped lines are spaced | |
| counterAlign | No | ||
| primaryAlign | No | ||
| reverseZIndex | No | Stack earlier children on top (canvas stacking) | |
| counterAxisGap | No | Space between wrapped rows or columns (wrap only) | |
| verticalSizing | No | ||
| horizontalSizing | No |