Skip to main content
Change the dimensions of a node by setting new width and height values.

Parameters

nodeId
string
required
The ID of the node to resize
width
number
required
New width in pixels (must be positive)
height
number
required
New height in pixels (must be positive)

Response

Returns the name of the resized node and its new dimensions.
{
  "name": "Container Frame"
}

Examples

Resize a frame to standard mobile dimensions

await resize_node({
  nodeId: "123:456",
  width: 375,
  height: 812
});

Make a button wider

await resize_node({
  nodeId: "789:012",
  width: 200,
  height: 48
});

Proportionally scale an element

// Get current dimensions
const nodeInfo = await get_node_info({ nodeId: "123:456" });
const currentWidth = nodeInfo.absoluteBoundingBox.width;
const currentHeight = nodeInfo.absoluteBoundingBox.height;

// Double the size while maintaining aspect ratio
await resize_node({
  nodeId: "123:456",
  width: currentWidth * 2,
  height: currentHeight * 2
});

Create a square from a rectangle

const nodeInfo = await get_node_info({ nodeId: "123:456" });
const maxDimension = Math.max(
  nodeInfo.absoluteBoundingBox.width,
  nodeInfo.absoluteBoundingBox.height
);

await resize_node({
  nodeId: "123:456",
  width: maxDimension,
  height: maxDimension
});

Notes

  • Both width and height must be positive numbers
  • Resizing affects the node’s bounding box; content inside may overflow or be clipped
  • Text nodes will reflow text content to fit the new dimensions
  • Auto-layout frames may constrain resizing behavior based on their layout settings
  • Children of resized frames are not automatically scaled

Build docs developers (and LLMs) love