Skip to main content

Version 1, Update 87

APIs for dynamic page loading

Over the past few months, Figma has been rolling out dynamic page loading, which allows documents to load pages on demand, rather than all at once. For backward compatibility, Figma loads all pages in the document before attempting to run an extension (a plugin or widget), which can sometimes result in a noticeable delay.

We're pleased to announce a new set of APIs that allow extensions to work safely with dynamic page loading, and avoid triggering the loading delay. Alongside these new APIs, we are deprecating several existing methods and properties. This will help to ensure that new extensions will be compatible with dynamic page loading by default.

To mark an extension as compatible with dynamic page loading, add "documentAccess": "dynamic-page" to manifest.json. Extensions with this manifest field will not encounter loading delays, but they'll be unable to access any of the deprecated methods and properties listed below. New extensions will include this manifest field by default.

To learn more about updating your extension, see our comprehensive migration guide. For TypeScript users, we've also provided an ESLint plugin that can help identify and automatically fix callsites that need to be updated.

Timeline

As of February 21st, dynamic page loading APIs are generally available (GA). You can update existing extensions and create new extensions using the dynamic page loading APIs and the manifest field "documentAccess": "dynamic-page".

Starting in April, the manifest field "documentAccess": "dynamic-page" will be required for all widgets, and all new plugins.

Net-new methods

Deprecations and replacements

Several methods and properties have been deprecated in favor of async replacements:

In some specific cases, reading node properties has been deprecated in favor of an async getter:

In some specific cases, assigning values directly to node properties has been deprecated in favor of an async setter:

If an extension's manifest contains "documentAccess": "dynamic-page", accessing any of the deprecated items listed above will throw an exception.

Method/property usage changes

If an extension's manifest contains "documentAccess": "dynamic-page", calling any of the following methods will throw an exception unless you first call figma.loadAllPagesAsync():

For the methods listed below, passing a string ID is now deprecated in favor of passing objects that the IDs refer to. If an extension's manifest contains "documentAccess": "dynamic-page", passing an ID will throw an exception.

If an extension's manifest contains "documentAccess": "dynamic-page", some properties and methods of PageNode will throw an exception unless you explicitly load the page first using PageNode.loadAsync(). These include:

Changes to events

Version 1, Update 85

New:

  • Measurements can be added to pin distances between nodes in Dev Mode. See Measurement.
  • Private beta only: annotations can be set on nodes to leave notes and pin properties in Dev Mode. See Annotation. More details on the public beta release of these APIs will be announced soon.

Version 1, Update 83

Updates:

  • Plugins can now view and set explicit modes for each variable collection on PageNodes.
  • The BaseStyle type is now defined as a union of all possible derived style interfaces, such as PaintStyle and GridStyle. This allows you to use type narrowing on the the type property to go from an instance of BaseStyle to a child style type.
  • Updated the color token values in the CSS Variables and Theming page for the “Figma Design: Light” and “Figma Design: Dark” modes to reflect recent formatting changes to token values injected into the plugin iframe (rgba() values were changed to #rrggbbaa format).
  • Variables can now be bound to Effect and Layout Grid styles. On a selection, variables bound to a given style are populated in boundVariables keyed by style type (effects or layoutGrids).

Version 1, Update 82

This update includes changes to the Variables API to support binding variables to effects, layout grids, stroke weights, and layer opacity. We are also releasing support to run Dev Mode plugins in the Figma for VS Code extension.

Changes to the Variables API:

Dev Mode plugins can now run in the Figma for VS Code extension with some minor manifest and code changes:

Fixes:

Version 1, Update 81

New:

  • We are introducing NEGATE as a Prototyping ExpressionFunction type!

Version 1, Update 80

New:

  • Plugins are now able to explicitly unbind variables from nodes. See setBoundVariable.
  • variableIds are now returned in a similar order to the Figma Design UI. See VariableCollection#variableIds
  • Adds ability to set and query pluginData on Variable and Variable Collection nodes.
  • Adds textRangeFills to the boundVariables structure. This will be populated on text nodes which have color variables bound to substrings.
  • Plugins/widgets that touch straight connectors and set endpoint magnets other than CENTER or NONE will now error in development. Please update your code to use the CENTER or NONE magnets for straight connectors before 2024. See Version 1, Update 79 for more details.
  • Added support for the devStatus field on Frames, Components, Component Sets, and Instances.

Updates for 2023-10-18

The Plugin API runtime has been updated to ensure proper usage of figma.showUI.

It is unsafe to call figma.showUI within an event handler for the figma.codegen.on("generate") event. In development, figma.showUI will now throw an error when called as a result of a figma.codegen.on("generate")

If you need to trigger code inside an iframe as the result of a generate callback, you should instead move the call to showUI outside of the event handler and use figma.ui.postMessage to communicate with the iframe from within the callback. This will ensure that your plugin can to handle concurrent generate events. Here's a code example for how to do this.