Skip to main content

ConnectorNode

A connector is used to connect FigJam components to indicate relationships. Connectors can be created using figma.createConnector.

Connector properties

type: 'CONNECTOR' [readonly]

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


text: TextSublayerNode [readonly]

Text sublayer of the ConnectorNode


textBackground: LabelSublayerNode [readonly]

Text sublayer of the ConnectorNode


cornerRadius?: number [readonly]

How rounded a connector's edges are


connectorLineType: 'ELBOWED' | 'STRAIGHT'

Connector path type


connectorStart: ConnectorEndpoint

Connector starting endpoint


connectorEnd: ConnectorEndpoint

Connector ending endpoint


connectorStartStrokeCap: ConnectorStrokeCap

Connector start stroke cap


connectorEndStrokeCap: ConnectorStrokeCap

Connector end stroke cap


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.

View more →

clone(): ConnectorNode

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


opacity: number

Opacity of the node, as shown in the Layer panel. Must be between 0 and 1.


blendMode: BlendMode

Blend mode of this node, as shown in the Layer panel. In addition to the blend modes that paints & effects support, the layer blend mode can also have the value PASS_THROUGH.


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 | figma.mixed

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

caution

For rectangle nodes or frame-like nodes using different individual stroke weights, this property will return figma.mixed.

info

For rectangle nodes or frame-like nodes, individual stroke weights can be set for each side using the following properties:


strokeJoin: StrokeJoin | figma.mixed

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

View more →

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

The alignment of the stroke with respect to the boundaries of the shape.

View 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.


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.

View 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.

View more →

name: string

The name of the layer that appears in the layers panel. Calling figma.root.name will return the name, read-only, of the current file.

View 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.

View 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.

View more →

remove(): void

Removes this node and all of its children from the document.

View 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 {}.

info

In Figma and Dev Mode, this shows up in the properties panel. In FigJam, this shows up in the property menu. See here for examples.

View more →

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

Retreives the reluanch data stored on this node using setRelaunchData


isAsset: boolean [readonly]

Returns true if Figma detects that a node is an asset, otherwise returns false. An asset is is either an icon or a raster image.

This property is useful if you’re building a plugin for code generation.

info

This property uses a set of heuristics to determine if a node is an asset. At a high level an icon is a small vector graphic and an image is a node with an image fill.


getCSSAsync(): Promise<{ [key: string]: string }>

Resolves to a JSON object of CSS properties of the node. This is the same CSS that Figma shows in the inspect panel and is helpful if you are building a plugin for code generation.


Plugin data properties

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.

View 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.

View 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.


Dev resource properties

getDevResourcesAsync(options?: { includeChildren: boolean }): Promise<DevResourceWithNodeId[]>

Gets all of the dev resources on a node. This includes any inherited dev resources from components and component sets.

View more →

addDevResourceAsync(url: string, name?: string): Promise<void>

Adds a dev resource to a node. This will fail if the node already has a dev resource with the same url.

View more →

editDevResourceAsync(currentUrl: string, newValue: { name: string; url: string }): Promise<void>

Edits a dev resource on a node. This will fail if the node does not have a dev resource with the same url.

View more →

deleteDevResourceAsync(url: string): Promise<void>

Deletes a dev resource on a node. This will fail if the node does not have a dev resource with the same url.

View more →

setDevResourcePreviewAsync(url: string, preview: PlainTextElement): Promise<void>

caution

This is a private API only available to Figma partners


x: number

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

View more →

y: number

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

View 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.


minWidth: number | null

Applicable only to auto-layout frames and their direct children. Value must be positive. Set to null to remove minWidth.


maxWidth: number | null

Applicable only to auto-layout frames and their direct children. Value must be positive. Set to null to remove maxWidth.


minHeight: number | null

Applicable only to auto-layout frames and their direct children. Value must be positive. Set to null to remove minHeight.


maxHeight: number | null

Applicable only to auto-layout frames and their direct children. Value must be positive. Set to null to remove maxHeight.


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.

View more →

absoluteTransform: Transform [readonly]

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


absoluteBoundingBox: Rect | null [readonly]

The bounds of the node that does not include rendered properties like drop shadows or strokes. The x and y inside this property represent the absolute position of the node on the page.


Scene node properties

visible: boolean

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

View 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.

View more →

stuckNodes: SceneNode[] [readonly]

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.

View more →

attachedConnectors: ConnectorNode[] [readonly]

An array of ConnectorNodes that are attached to a node.


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 or an instance sublayer. It will be null otherwise. The value in the key-value pair refers to the component property name as returned by componentPropertyDefinitions on the containing component, component set or main component (for instances).


boundVariables?: { readonly [field in VariableBindableNodeField]?: VariableAlias} & { fills: VariableAlias[]; strokes: VariableAlias[]; componentProperties: { [propertyName: string]: VariableAlias }; textRangeFills: VariableAlias[] } [readonly]

The variables bound to a particular field on this node. Please see the Working with Variables guide for how to get and set variable bindings.


setBoundVariable(field: VariableBindableNodeField, variableId: string | null): void

Binds the provided field on this node to the given variable. Please see the Working with Variables guide for how to get and set variable bindings.

If null is provided as the variableId, the given field will be unbound from any variables.


inferredVariables?: { readonly [field in VariableBindableNodeField]?: VariableAlias[]} & { fills: VariableAlias[][]; strokes: VariableAlias[][] } [readonly]

An object, keyed by field, returning any variables that match the raw value of that field for the mode of the node (or the default variable value if no mode is set)

View more →

resolvedVariableModes: { [collectionId: string]: string }

The resolved mode for this node for each variable collection in this file.

View more →

explicitVariableModes: { [collectionId: string]: string }

The explicitly set modes for this node. Represents a subset of resolvedVariableModes.


clearExplicitVariableModeForCollection(collectionId: string): void

clears an explicit mode for the given collection on this node


setExplicitVariableModeForCollection(collectionId: string, modeId: string): void

Sets an explicit mode for the given collection on this node


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>

exportAsync(settings: ExportSettingsSVGString): Promise<string>

exportAsync(settings: ExportSettingsREST): Promise<Object>

Exports the node as an encoded image.

View more →