Figma MCP auto layout
FigmaMCP lets Claude Code or Codex turn auto layout on for a frame and set direction, wrapping, padding, spacing, alignment and sizing, all through one tool: node_set_auto_layout. Each call changes one frame, and the frame’s name must match. Ask for a picture afterwards, so the agent can check its own work.
Examples
| You ask | Result |
|---|---|
| “Stack these items vertically with 12px gap” | Vertical auto layout, spacing 12 |
| “Add 24px padding all round” | Padding 24 on all sides |
| “Centre the content” | Alignment set to centre |
Parameters of node_set_auto_layout
FigmaMCP’s node_set_auto_layout is one setter. You send nodeId, the frame’s exact nodeName, and any of the fields below. Fields you leave out stay as they are.
| Field | Values | Note |
|---|---|---|
layoutMode | NONE, HORIZONTAL, VERTICAL | NONE turns auto layout off. |
layoutWrap | NO_WRAP, WRAP | Wrapping rows or columns. |
paddingTop, paddingRight, paddingBottom, paddingLeft | Numbers | Set each side on its own. |
itemSpacing | Number | Ignored when the primary axis uses SPACE_BETWEEN. |
counterAxisSpacing | Number | Works only when layoutWrap is WRAP. |
primaryAxisAlignItems | MIN, MAX, CENTER, SPACE_BETWEEN | Along the layout direction. |
counterAxisAlignItems | MIN, MAX, CENTER, BASELINE | Across the layout direction. |
layoutSizingHorizontal, layoutSizingVertical | FIXED, HUG, FILL | HUG suits frames and text. FILL suits children of an auto layout frame. |
Turn a stack of frames into auto layout
- Read the page with
page_info, then the frame withnode_info. Copy its exact name. - Call
node_set_auto_layoutwith the direction, spacing and padding you want. - Export the frame with
node_export_visualand look at the picture. - Repeat for the next frame.
The tool takes one frame per call. A whole page therefore means many calls, and each call checks its own name. There is no batch that rolls back. If you ask for a page, ask the agent to do one section first and show you the picture.
Auto layout and variables
FigmaMCP can bind padding and spacing to variables with node_bind_variable, for fields such as paddingLeft and itemSpacing. The frame must have auto layout on first. If it does not, the bind fails with a message that auto layout is off. Run node_set_auto_layout with a layoutMode, then bind.
When a call is refused
| Error or message | Meaning | What to do |
|---|---|---|
NAME_MISMATCH | The name you sent is not the frame’s current name. | Read the frame again with node_info, then retry. |
READ_ONLY_MODE | The AI can edit this file switch is off. | Turn it on in the plugin. |
OUTSIDE_SCOPE | The frame is outside the editable scope. | Pick a frame inside the scope. |
Operation Denied: locked | The frame or one of its ancestors is locked. | Unlock it in Figma. |
Ask for a picture after the change: see Figma MCP export image.
Download for Mac Version 0.1.20 macOS 14+ · Intel & Apple Silicon · ~155 MB
Related: All tools · Write tools · Export
Questions
Can it convert a whole page to auto layout?
Can it set different padding on each side?
Why was my spacing ignored?
Can it bind spacing to a variable?
Last updated: