Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/open-pencil/open-pencil/llms.txt

Use this file to discover all available pages before exploring further.

create_shape

Create a shape on the canvas. Use FRAME for containers/cards, RECTANGLE for solid blocks, ELLIPSE for circles, TEXT for labels, SECTION for page sections.
type
string
required
Node type. Options: FRAME, RECTANGLE, ELLIPSE, TEXT, LINE, STAR, POLYGON, SECTION
x
number
required
X position
y
number
required
Y position
width
number
required
Width in pixels (minimum: 1)
height
number
required
Height in pixels (minimum: 1)
name
string
Node name shown in layers panel
parent_id
string
Parent node ID to nest inside
Returns
object
Returns a summary of the created node (id, name, type).

render

Render JSX to design nodes. Primary creation tool — creates entire component trees in one call.
jsx
string
required
JSX string to render. Example: <Frame name="Card" w={320} h="hug" flex="col" gap={16} p={24} bg="#FFF" rounded={16}><Text size={18} weight="bold">Title</Text></Frame>
x
number
X position of the root node
y
number
Y position of the root node
parent_id
string
Parent node ID to render into
Returns
object
Returns the root node summary with id, name, type, and children IDs.

update_node

Update properties of an existing node: position, size, opacity, corner radius, visibility, text, font.
id
string
required
Node ID
x
number
X position
y
number
Y position
width
number
Width (minimum: 1)
height
number
Height (minimum: 1)
opacity
number
Opacity (0-1)
corner_radius
number
Corner radius (minimum: 0)
visible
boolean
Visibility
text
string
Text content (TEXT nodes)
font_size
number
Font size (minimum: 1)
font_weight
number
Font weight (100-900)
name
string
Layer name
Returns
object
Returns the node ID and array of updated properties.

delete_node

Delete a node by ID.
id
string
required
Node ID to delete
Returns
object
Returns the deleted node ID.

clone_node

Clone (duplicate) a node.
id
string
required
Node ID to clone
Returns
object
Returns a summary of the cloned node (id, name, type).

rename_node

Rename a node in the layers panel.
id
string
required
Node ID
name
string
required
New name
Returns
object
Returns the node ID and new name.

reparent_node

Move a node into a different parent.
id
string
required
Node ID to move
parent_id
string
required
New parent node ID
Returns
object
Returns the node ID and parent ID.

node_move

Move a node to new coordinates.
id
string
required
Node ID
x
number
required
X position
y
number
required
Y position
Returns
object
Returns the node ID and new coordinates.

node_resize

Resize a node.
id
string
required
Node ID
width
number
required
Width (minimum: 1)
height
number
required
Height (minimum: 1)
Returns
object
Returns the node ID and new dimensions.

node_replace_with

Replace a node with JSX content.
id
string
required
Node ID to replace
jsx
string
required
JSX string for the replacement
Returns
object
Returns the new node summary (id, name, type).

select_nodes

Select one or more nodes by ID.
ids
string[]
required
Node IDs to select
Returns
object
Returns the selected node IDs.

group_nodes

Group selected nodes.
ids
string[]
required
Node IDs to group (minimum: 2)
Returns
object
Returns the group node summary (id, name, type).

ungroup_node

Ungroup a group node.
id
string
required
Group node ID
Returns
object
Returns the ungrouped node ID.

flatten_nodes

Flatten nodes into a single vector.
ids
string[]
required
Node IDs to flatten
Returns
object
Returns the flattened node summary (id, name, type).

create_component

Convert a frame/group into a component.
id
string
required
Node ID to convert
Returns
object
Returns the component node summary (id, name, type).

create_instance

Create an instance of a component.
component_id
string
required
Component node ID
x
number
X position
y
number
Y position
Returns
object
Returns the instance node summary (id, name, type).

create_page

Create a new page.
name
string
required
Page name
Returns
object
Returns the page ID and name.

switch_page

Switch to a different page by name or ID.
page
string
required
Page name or ID
Returns
object
Returns the page name and ID.

create_vector

Create a vector node with optional path data.
x
number
required
X position
y
number
required
Y position
name
string
Node name
path
string
VectorNetwork JSON
fill
color
Fill color (hex)
stroke
color
Stroke color (hex)
stroke_weight
number
Stroke weight
parent_id
string
Parent node ID
Returns
object
Returns the vector node summary (id, name, type).

create_slice

Create a slice (export region) on the canvas.
x
number
required
X position
y
number
required
Y position
width
number
required
Width (minimum: 1)
height
number
required
Height (minimum: 1)
name
string
Slice name
parent_id
string
Parent node ID
Returns
object
Returns the slice node summary (id, name, type).

create_variable

Create a new variable in a collection.
name
string
required
Variable name
type
string
required
Variable type. Options: COLOR, FLOAT, STRING, BOOLEAN
collection_id
string
required
Collection ID
value
string
Initial value (hex for COLOR, number for FLOAT, etc.)
Returns
object
Returns the created variable object.

set_variable

Set the value of a variable for a specific mode.
id
string
required
Variable ID
mode
string
required
Mode ID
value
string
required
Value (hex for COLOR, number for FLOAT, etc.)
Returns
object
Returns the variable ID, mode, and new value.

delete_variable

Delete a variable.
id
string
required
Variable ID
Returns
object
Returns the deleted variable ID.

bind_variable

Bind a variable to a node property (fills, strokes, opacity, width, height, etc.).
node_id
string
required
Node ID
field
string
required
Property field (fills, strokes, opacity, width, height, etc.)
variable_id
string
required
Variable ID
Returns
object
Returns the node ID, field, and variable ID.

create_collection

Create a new variable collection.
name
string
required
Collection name
Returns
object
Returns the created collection object.

delete_collection

Delete a variable collection and all its variables.
id
string
required
Collection ID
Returns
object
Returns the deleted collection ID.

boolean_union

Union (combine) multiple nodes.
ids
string[]
required
Node IDs to union
Returns
object
Returns the resulting boolean node summary (id, name, type).

boolean_subtract

Subtract the second node from the first.
ids
string[]
required
Node IDs (first minus rest)
Returns
object
Returns the resulting boolean node summary (id, name, type).

boolean_intersect

Intersect multiple nodes.
ids
string[]
required
Node IDs to intersect
Returns
object
Returns the resulting boolean node summary (id, name, type).

boolean_exclude

Exclude (XOR) multiple nodes.
ids
string[]
required
Node IDs to exclude
Returns
object
Returns the resulting boolean node summary (id, name, type).

path_set

Set vector path data on a node. Provide a VectorNetwork JSON.
id
string
required
Node ID
path
string
required
VectorNetwork JSON
Returns
object
Returns the node ID.

path_scale

Scale vector path from center.
id
string
required
Node ID
factor
number
required
Scale factor (e.g. 2 for double)
Returns
object
Returns the node ID and scale factor.

path_flip

Flip vector path horizontally or vertically.
id
string
required
Node ID
axis
string
required
Flip axis. Options: horizontal, vertical
Returns
object
Returns the node ID and flip axis.

path_move

Move all path points by an offset.
id
string
required
Node ID
dx
number
required
X offset
dy
number
required
Y offset
Returns
object
Returns the node ID and offsets.

eval

Execute JavaScript with full Figma Plugin API access. Use for operations not covered by other tools. The figma global is available.
code
string
required
JavaScript code to execute
Returns
any
Returns the result of the executed code, or null if no return value.