Overview
Create a new rectangle in Figma with specified position, size, and optional properties.Parameters
X position of the rectangle
Y position of the rectangle
Width of the rectangle
Height of the rectangle
Optional name for the rectangle. Defaults to “Rectangle” if not provided.
Optional parent node ID to append the rectangle to. If not provided, the rectangle is created in the current selection or page.
Return Type
Returns an object with:name(string): The name of the created rectangleid(string): The unique ID of the created rectangle
Usage Examples
Basic Rectangle
Create a simple rectangle at position (100, 100) with size 200x150:Named Rectangle
Create a rectangle with a custom name:Rectangle Inside a Frame
Create a rectangle as a child of an existing frame:Notes
- After creation, you can use the returned ID with other tools like
set_fill_color,set_stroke_color, orset_corner_radiusto style the rectangle - Position coordinates are relative to the parent container if
parentIdis specified - The rectangle is created with default styling (no fill, no stroke) - use styling tools to customize appearance