Skip to main content

Overview

Create a new rectangle in Figma with specified position, size, and optional properties.

Parameters

number
required
X position of the rectangle
number
required
Y position of the rectangle
number
required
Width of the rectangle
number
required
Height of the rectangle
string
Optional name for the rectangle. Defaults to “Rectangle” if not provided.
string
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 rectangle
  • id (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, or set_corner_radius to style the rectangle
  • Position coordinates are relative to the parent container if parentId is specified
  • The rectangle is created with default styling (no fill, no stroke) - use styling tools to customize appearance