Figma Developers

Figma Developers

  • Introduction
  • API Reference
  • Updates

›Figma APIs

Figma APIs

  • API Overview
  • The Typings File
  • figma
  • figma.ui
  • figma.viewport
  • figma.clientStorage
  • API errors

Node APIs

  • Node Types
  • BooleanOperationNode
  • ComponentNode
  • ComponentSetNode
  • DocumentNode
  • EllipseNode
  • FrameNode
  • GroupNode
  • InstanceNode
  • LineNode
  • PageNode
  • PolygonNode
  • RectangleNode
  • SliceNode
  • StarNode
  • TextNode
  • VectorNode

Datatypes

  • Action
  • ArcData
  • BlendMode
  • Constraints
  • Effect
  • ExportSettings
  • FontName
  • Guide
  • HandleMirroring
  • Image
  • LayoutGrid
  • LetterSpacing
  • LineHeight
  • OverflowDirection
  • Overlay
  • Paint
  • PublishStatus
  • Reaction
  • Rect
  • RGB/RGBA
  • StrokeCap
  • StrokeJoin
  • TextCase
  • TextDecoration
  • Transition
  • Transform
  • Trigger
  • Vector
  • VectorPath
  • VectorNetwork
  • BaseStyle
  • EffectStyle
  • GridStyle
  • PaintStyle
  • TextStyle

Properties

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

figma.ui

These are methods and properties available on the figma.ui global object. A UI is created via figma.showUI. See the Creating a User Interface tutorial on how to use this API.

show(): void

Makes the plugin's UI visible. Use this to show the UI if it was created using figma.showUI(..., { visible: false }), or after a call to figma.ui.hide().

hide(): void

Hides the current UI. The UI will still continue to run code and be able to send and receive messages. However, it is not rendered to the user.

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

Changes the size of the UI, after it has been created. Note that the size can also be set in the initial options.

close(): void

Destroys the UI and its containing <iframe>. Once this has been called, the code inside the iframe will be stopped and you can no longer send messages to and from it.

postMessage(pluginMessage: any, options?: UIPostMessageOptions): void

Sends a message to the UI's <iframe> window. [Read more]

onmessage: ((pluginMessage: any, props: OnMessageProperties) => void) | undefined

Register a handler for incoming messages from the UI's <iframe> window. [Read more]

on(type: "message", callback: (pluginMessage: any, props: OnMessageProperties) => void): void

Register a handler for incoming messages from the UI's <iframe> window. [Read more]

once(type: "message", callback: (pluginMessage: any, props: OnMessageProperties) => void): void

Register a handler for incoming messages from the UI's <iframe> window. Same as figma.ui.on("message"), but only gets called the first time.

off(type: "message", callback: (pluginMessage: any, props: OnMessageProperties) => void): void

Removes a handler added via figma.ui.on.

← figmafigma.viewport →
Learn more about Figma