set_item_spacing
Adjust spacing between elements in auto-layout frames to create consistent visual hierarchy and improve design alignment.
Instructions
Set distance between children in an auto-layout frame
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the frame to modify | |
| itemSpacing | Yes | Distance between children. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN. |
Implementation Reference
- MCP server.tool registration, input schema (Zod), and handler function for the 'set_item_spacing' tool. The handler proxies the parameters to a Figma plugin command via sendCommandToFigma and formats the response.server.tool( "set_item_spacing", "Set distance between children in an auto-layout frame", { nodeId: z.string().describe("The ID of the frame to modify"), itemSpacing: z.number().describe("Distance between children. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.") }, async ({ nodeId, itemSpacing }) => { try { const result = await sendCommandToFigma("set_item_spacing", { nodeId, itemSpacing }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Set item spacing to ${itemSpacing} for frame "${typedResult.name}"`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error setting item spacing: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );
- The 'set_item_spacing' command is included in the FigmaCommand type union, confirming it's a recognized Figma plugin command proxied by this MCP tool.| "set_item_spacing"