Figma Plugins

Figma Plugins

  • Introduction
  • API Reference
  • Updates

›Node APIs

Figma APIs

  • API Reference
  • The Typings File
  • figma
  • figma.ui
  • figma.timer
  • figma.viewport
  • figma.clientStorage
  • figma.parameters
  • API errors

Node APIs

  • Node Types
  • BooleanOperationNode
  • CodeBlockNode
  • ComponentNode
  • ComponentSetNode
  • ConnectorNode
  • DocumentNode
  • EllipseNode
  • EmbedNode
  • FrameNode
  • GroupNode
  • HighlightNode
  • InstanceNode
  • LineNode
  • LinkUnfurlNode
  • MediaNode
  • PageNode
  • PolygonNode
  • RectangleNode
  • SectionNode
  • ShapeWithTextNode
  • SliceNode
  • StampNode
  • StarNode
  • StickyNode
  • TextNode
  • VectorNode
  • WashiTapeNode
  • WidgetNode

Data Types

  • Action
  • ActiveUser
  • ArcData
  • BlendMode
  • ConnectorEndpoint
  • ConnectorStrokeCap
  • Constraints
  • ComponentProperties
  • ComponentPropertyDefinitions
  • ComponentPropertyType
  • Effect
  • EmbedData
  • ExportSettings
  • FontName
  • Guide
  • HandleMirroring
  • HyperlinkTarget
  • Image
  • LabelSublayer
  • LayoutGrid
  • LetterSpacing
  • LineHeight
  • LinkUnfurlData
  • MediaData
  • OverflowDirection
  • Overlay
  • Paint
  • PublishStatus
  • Reaction
  • Rect
  • RGB/RGBA
  • StrokeCap
  • StrokeJoin
  • StyledTextSegment
  • TextCase
  • TextDecoration
  • TextSublayer
  • Transition
  • Transform
  • Trigger
  • User
  • Vector
  • VectorPath
  • VectorNetwork
  • BaseStyle
  • EffectStyle
  • GridStyle
  • PaintStyle
  • TextStyle

Properties

  • rotation
  • findAll
  • findAllWithCriteria
  • findChild
  • findChildren
  • findOne
  • constraint
  • svgOutlineText
  • scaleFactor
  • swapComponent
  • resize
  • resizeWithoutConstraints
  • flowStartingPoints
  • guides
  • selectedTextRange
  • selection
  • resizeWithoutConstraints
  • rescale
  • resize
  • rotation
  • autoRename
  • characters
  • deleteCharacters
  • getStyledTextSegments
  • insertCharacters
  • textAutoResize
  • data
  • windingRule
  • cloneWidget
  • setWidgetSyncedState
  • closePlugin
  • combineAsVariants
  • commitUndo
  • createBooleanOperation
  • createComponent
  • createConnector
  • createEllipse
  • createFrame
  • createGif
  • createImage
  • createLine
  • createLinkPreviewAsync
  • createPage
  • createPolygon
  • createRectangle
  • createShapeWithText
  • createSlice
  • createStar
  • createSticky
  • createText
  • createVector
  • flatten
  • group
  • loadFontAsync
  • mixed
  • notify
  • off
  • on
  • saveVersionHistoryAsync
  • showUI
  • skipInvisibleInstanceChildren
  • on
  • onmessage
  • postMessage
  • ungroup
  • zoom
  • appendChild
  • children
  • constraints
  • cornerRadius
  • cornerSmoothing
  • counterAxisAlignItems
  • counterAxisSizingMode
  • description
  • documentationLinks
  • exportAsync
  • fills
  • fillStyleId
  • findAll
  • findAllWithCriteria
  • findChild
  • findChildren
  • findOne
  • findWidgetNodesByWidgetId
  • id
  • insertChild
  • layoutAlign
  • layoutGrow
  • layoutMode
  • layoutPositioning
  • locked
  • name
  • numberOfFixedChildren
  • overflowDirection
  • parent
  • primaryAxisAlignItems
  • primaryAxisSizingMode
  • relativeTransform
  • remove
  • removed
  • rescale
  • resize
  • resizeWithoutConstraints
  • rotation
  • setPluginData
  • setRelaunchData
  • setSharedPluginData
  • strokeAlign
  • strokeCap
  • strokeJoin
  • stuckNodes
  • stuckTo
  • toString
  • visible
  • x
  • y

HighlightNode

A HighlightNode is very similar to a VectorNode but they are considered stickables and "stick" to nodes that they are positioned on top of. They are created using the highlighter tool in FigJam.

HighlightNode properties

type: 'HIGHLIGHT' [readonly]

The type of this node, represented by the string literal "HIGHLIGHT"

clone(): HighlightNode

Duplicates the highlight node. By default, the duplicate will be parented under figma.currentPage.

vectorNetwork: VectorNetwork

Exposes a complete, but more complex representation of vectors as a network of edges between vectices. See VectorNetwork.

vectorPaths: VectorPaths

Exposes a simple, but incomplete representation of vectors as path. See VectorPaths

handleMirroring: HandleMirroring | PluginAPI['mixed']

Whether the vector handles are mirrored or independent.

Base node properties

id: string [readonly]

An internal identifier for a node. Plugins typically don't need to use this since you can usually just access a node directly. [Read more]

parent: (BaseNode & ChildrenMixin) | null [readonly]

Returns the parent of this node, if any. This property is not meant to be directly edited. To reparent, see appendChild. [Read more]

name: string

The name of the layer that appears in the layers panel. This may update automatically for text layers. Returns the name of the current file on figma.root (read-only). [Read more]

removed: boolean [readonly]

Returns true if this node has been removed since it was first accessed. If your plugin stays open for a while and stores references to nodes, you should write your code defensively and check that the nodes haven't been removed by the user. [Read more]

toString(): string

Returns a string representation of the node. For debugging purposes only, do not rely on the exact output of this string in production code. [Read more]

remove(): void

Removes this node and all of its children from the document. [Read more]

setRelaunchData(data: { [command: string]: string }): void

Sets state on the node to show a button and description when the node is selected. Clears the button and description when relaunchData is {}.

In Figma, this shows up in the properties panel. In FigJam, this shows up in the property menu. See here for examples. [Read more]

getRelaunchData(): { [command: string]: string }

Retreives the reluanch data stored on this node using setRelaunchData

getPluginData(key: string): string

Retrieves custom information that was stored on this node or style using setPluginData. If there is no data stored for the provided key, an empty string is returned.

setPluginData(key: string, value: string): void

Lets you store custom information on any node or style, private to your plugin. [Read more]

getPluginDataKeys(): string[]

Retrieves a list of all keys stored on this node or style using using setPluginData. This enables iterating through all data stored privately on a node or style by your plugin.

getSharedPluginData(namespace: string, key: string): string

Retrieves custom information that was stored on this node or style using setSharedPluginData. If there is no data stored for the provided namespace and key, an empty string is returned.

setSharedPluginData(namespace: string, key: string, value: string): void

Lets you store custom information on any node or style, public to all plugins. [Read more]

getSharedPluginDataKeys(namespace: string): string[]

Retrieves a list of all keys stored on this node or style using setSharedPluginData. This enables iterating through all data stored in a given namespace.

Scene node properties

visible: boolean

Whether the node is visible or not. Does not affect a plugin's ability to access the node. [Read more]

locked: boolean

Whether the node is locked or not, preventing certain user interactions on the canvas such as selecting and dragging. Does not affect a plugin's ability to write to those properties. [Read more]

stuckNodes: SceneNode[]

An array of nodes that are "stuck" to this node. In FigJam, stamps, highlights, and some widgets can "stick" to other nodes if they are dragged on top of another node. [Read more]

componentPropertyReferences: { [nodeProperty in 'visible' | 'characters' | 'mainComponent']: string } | null

All component properties that are attached on this node. A node can only have componentPropertyReferences if it is a component sublayer and is not nested within an instance node. Is null otherwise. The value in the key-value pair refers to the component property name as returned by componentPropertyDefinitions on the containing component or component set.

Blend-related properties

isMask: boolean

Whether this node is a mask. A mask node masks its subsequent siblings.

effects: ReadonlyArray<Effect>

Array of effects. See Effect type. For help on how to change this value, see Editing Properties.

effectStyleId: string

The id of the EffectStyle object that the properties of this node are linked to.

Corner-related properties

cornerRadius: number | PluginAPI['mixed']

The number of pixels to round the corners of the object by. [Read more]

cornerSmoothing: number

A value that lets you control how "smooth" the corners are. Ranges from 0 to 1. [Read more]

Geometry-related properties

fills: ReadonlyArray<Paint> | PluginAPI['mixed']

The paints used to fill the area of the shape. For help on how to change this value, see Editing Properties. [Read more]

fillStyleId: string | PluginAPI['mixed']

The id of the PaintStyle object that the fills property of this node is linked to. [Read more]

strokes: ReadonlyArray<Paint>

The paints used to fill the area of the shape's strokes. For help on how to change this value, see Editing Properties.

strokeStyleId: string

The id of the PaintStyle object that the strokes property of this node is linked to.

strokeWeight: number

The thickness of the stroke, in pixels. This value must be non-negative and can be fractional.

strokeJoin: StrokeJoin | PluginAPI['mixed']

The decoration applied to vertices which have two or more connected segments. [Read more]

strokeAlign: 'CENTER' | 'INSIDE' | 'OUTSIDE'

The alignment of the stroke with respect to the boundaries of the shape. [Read more]

dashPattern: ReadonlyArray<number>

A list of numbers specifying alternating dash and gap lengths, in pixels.

strokeGeometry: VectorPaths

An array of paths representing the object strokes relative to the node. StrokeGeometry is always from the center regardless of the nodes strokeAlign.

strokeCap: StrokeCap | PluginAPI['mixed']

The decoration applied to vertices which have only one connected segment. [Read more]

strokeMiterLimit: number

The miter limit on the stroke. This is the same as the SVG miter limit.

outlineStroke(): VectorNode | null

This method performs an action similar to using the "Outline Stroke" function in the editor from the right-click menu. However, this method creates and returns a new node while leaving the original intact. Returns null if the node has no strokes.

fillGeometry: VectorPaths

An array of paths representing the object fills relative to the node.

Layout-related properties

absoluteTransform: Transform [readonly]

The position of a node relative to its containing page as a Transform matrix.

relativeTransform: Transform

The position of a node relative to its containing parent as a Transform matrix. Not used for scaling, see width and height instead. Read the details page to understand the nuances of this property. [Read more]

x: number

The position of the node. Identical to relativeTransform[0][2]. [Read more]

y: number

The position of the node. Identical to relativeTransform[1][2]. [Read more]

rotation: number

The rotation of the node in degrees. Returns values from -180 to 180. Identical to Math.atan2(-m10, m00) in the relativeTransform matrix. When setting rotation, it will also set m00, m01, m10, m11. [Read more]

width: number [readonly]

The width of the node. Use a resizing method to change this value.

height: number [readonly]

The height of the node. Use a resizing method to change this value.

absoluteRenderBounds: Rect | null [readonly]

The actual bounds of a node accounting for drop shadows, thick strokes, and anything else that may fall outside the node's regular bounding box defined in x, y, width, and height. The x and y inside this property represent the absolute position of the node on the page. This value will be null if the node is invisible.

constrainProportions: boolean

When toggled, causes the layer to keep its proportions when the user resizes it via the properties panel.

layoutAlign: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'INHERIT'

Applicable only on direct children of auto-layout frames, ignored otherwise. Determines if the layer should stretch along the parent’s counter axis. Defaults to “INHERIT”. [Read more]

layoutGrow: number

This property is applicable only for direct children of auto-layout frames, ignored otherwise. Determines whether a layer should stretch along the parent’s primary axis. 0 corresponds to a fixed size and 1 corresponds to stretch. [Read more]

layoutPositioning: 'AUTO' | 'ABSOLUTE'

This property is applicable only for direct children of auto-layout frames. Determines whether a layer's size and position should be dermined by auto-layout settings or manually adjustable. [Read more]

resize(width: number, height: number): void

Resizes the node. If the node contains children with constraints, it applies those constraints during resizing. If the parent has auto-layout, causes the parent to be resized. [Read more]

resizeWithoutConstraints(width: number, height: number): void

Resizes the node. Children of the node are never resized, even if those children have constraints. If the parent has auto-layout, causes the parent to be resized (this constraint cannot be ignored). [Read more]

rescale(scale: number): void

Rescales the node. This API function is the equivalent of using the Scale Tool from the toolbar. [Read more]

constraints: Constraints

Constraints of this node relative to its containing FrameNode, if any. [Read more]

Export-related properties

exportSettings: ReadonlyArray<ExportSettings>

List of export settings stored on the node. For help on how to change this value, see Editing Properties.

exportAsync(settings?: ExportSettings): Promise<Uint8Array>

Exports the node as an encoded image. [Read more]

Reaction prototyping-related properties

reactions: ReadonlyArray<Reaction>

List of Reactions on this node, which includes both the method of interaction with this node in a prototype, and the behavior of that interaction. For help on how to change this value, see Editing Properties.

Frame prototyping-related properties

overflowDirection: OverflowDirection

Determines whether a frame will scroll in presentation mode when the frame contains content that exceed the frame's bounds. Reflects the value shown in "Overflow Behavior" in the Prototype tab. [Read more]

numberOfFixedChildren: number

Determines which children of the frame are fixed children in a scrolling frame. [Read more]

overlayPositionType: OverlayPositionType [readonly]

How this frame is positioned when opened as an overlay.

overlayBackground: OverlayBackground [readonly]

How this frame obscures the content under it when opened as an overlay.

overlayBackgroundInteraction: OverlayBackgroundInteraction [readonly]

How the user can interact with the content under this frame when opened as an overlay.

Stickable properties

In FigJam a stickable is any node that sticks to other nodes when put on top of them. If the node the stickable is stuckTo moves, the stickable moves along with it.

stuckTo: SceneNode | null

If this node is stuck to another node this property returns that node or null. [Read more]

← GroupNodeInstanceNode →
  • HighlightNode properties
  • Base node properties
  • Scene node properties
  • Blend-related properties
  • Corner-related properties
  • Geometry-related properties
  • Layout-related properties
  • Export-related properties
  • Reaction prototyping-related properties
  • Frame prototyping-related properties
  • Stickable properties
Learn more about Figma