Docs / Guides
Figma plugins in the Proto Studio
The Proto Studio (Labs) runs Figma plugins on a Proto design: the plugin's manifest.json, its main code and its
UI are loaded as they are, and the figma global the code talks to is implemented on top of the Proto model and its
operations (ADR 0034, amendment B).
Many plugins that create, rename, restyle or inspect layers work unchanged; plugins that depend on Figma-only data
(libraries, users, vector networks, FigJam) do not. This page says what works.
For users#
Plugins menu of the Proto Studio:
- Plugins… lists the installed plugins with a button per command (a manifest's
menu), network access status, Revoke Network Access and Remove, and the install buttons. - Install Plugin from Folder… (the folder with
manifest.json, typically the plugin's development folder with its builtcode.jsandui.html) and Install Plugin from ZIP…. A dialog shows the name, the network access the plugin asks for and what OpenFini does not support before anything is installed. - Run Last Plugin, Stop Plugin, and Run Plugin from Folder (Development)…, which runs a folder without
installing it (and also allows the manifest's
devAllowedDomains).
Every batch of changes a plugin makes is one undo step named Plugin: <name>: everything a plugin does in one go
(until it waits for something, or calls figma.commitUndo()) is undone with one Undo. Installed plugins and their
clientStorage (5 MB per plugin) are stored in the browser profile on this device.
Safety#
- The plugin's main code runs in a dedicated worker inside a sandboxed frame (opaque origin, no access to the app,
its files, storage or cookies). Before the plugin runs,
XMLHttpRequest,WebSocket,EventSource,importScripts,indexedDB,cachesand nested workers are removed; the frame's Content-Security-Policy allows no network at all. - Network access is off unless the manifest asks for it in
networkAccess.allowedDomainsand you allow it when the plugin first runs. Thenfetchin the main code is answered by OpenFini for URLs that match the allowed domains only (scheme,*.subdomains, port and path prefixes as in Figma's manifest format; no credentials or cookies are sent), and the UI frame'sconnect-srclists exactly those domains."none"or a missingnetworkAccessmeans no network. - The plugin's UI is a second sandboxed frame (opaque origin) in a small window. Messages pass only as
pluginMessagebetween the UI and the plugin, as in Figma. - Every change goes through the Proto engine, which validates it: a plugin can only do what the operation layer allows (layers, pages, components, variables, styles, images), and a refused batch changes nothing.
Compatibility notes#
- Ids are Proto ids (
n…,p…), not Figma's1:2form; plugins that only pass ids around are unaffected. - Coordinates:
x,yare relative to the parent as in Figma. Layers in auto layout report their measured position.rotationis counter-clockwise in degrees as in Figma (Proto stores clockwise rotation). - Sizes:
widthandheightof hug and fill layers are the measured sizes from the canvas. - Text: writing
characters,fontSize,fontName, spacing, case or decoration needsawait figma.loadFontAsync(font)first, exactly like Figma (the same error otherwise). Fonts are the browser's;loadFontAsyncdoes not download anything. Range functions (setRangeFontSize, …) work on the whole text only. - Instances expose their main component, variant values and properties, but not their inner layers as nodes
(
instance.childrenis empty). - Undo:
figma.commitUndo()closes the current undo step;figma.triggerUndo()is not available. - UI: inline
<script>blocks of the plugin's UI work (they are delivered asdata:URLs); inline event handler attributes (onclick="…") do not, because the app's policy forbids inline handlers. Bundled UIs (React, Svelte, plain DOM withaddEventListener) are unaffected.
API coverage#
Supported: works as documented by Figma. Partial: works with the limits noted. Missing: throws a clear error
(figma.<name> is not supported in OpenFini) or returns an empty value.
| Area | API | Status | Notes |
|---|---|---|---|
| Globals | figma.root, figma.currentPage (get, set), setCurrentPageAsync, loadAllPagesAsync | Supported | |
figma.editorType, apiVersion, command, pluginId, mixed, mode | Supported | editorType is "figma" | |
figma.on / once / off: selectionchange, currentpagechange, close, run | Supported | ||
documentchange | Partial | fires with an empty documentChanges list | |
figma.notify | Supported | button option ignored | |
figma.closePlugin, figma.commitUndo | Supported | ||
figma.triggerUndo, saveVersionHistoryAsync, currentUser, activeUsers, payments, timer, codegen, textreview | Missing | currentUser is null, activeUsers [] | |
figma.base64Encode / base64Decode, figma.util.rgb / rgba / solidPaint | Supported | ||
| Nodes | getNodeById, getNodeByIdAsync | Supported | |
children, parent, appendChild, insertChild, remove, clone, removed | Supported | ||
findAll, findOne, findChildren, findChild, findAllWithCriteria({ types }) | Supported | ||
getPluginData / setPluginData / getPluginDataKeys | Supported | stored in the layer's code.plugin field | |
getSharedPluginData / setSharedPluginData | Missing | ||
| Creating | createFrame, createRectangle, createEllipse, createLine, createText, createComponent, createVector, createPage | Supported | |
createComponentFromNode, combineAsVariants, component.createInstance, group | Supported | ||
createImage | Partial | bytes become a design image; getSizeAsync returns 0 × 0 | |
createBooleanOperation, union, subtract, intersect, exclude, flatten, createNodeFromSvg, createSlice, createStar, createPolygon | Missing | ||
| Geometry | x, y, width, height, resize, resizeWithoutConstraints, rescale, rotation, relativeTransform | Supported | transforms carry translation only |
absoluteTransform, absoluteBoundingBox | Partial | from the canvas measurement; no rotation | |
constraints | Supported | ||
| Appearance | name, visible, locked, opacity, blendMode | Supported | |
fills (solid, linear / radial / angular gradients, images), strokes (solid), strokeWeight, strokeAlign, dashPattern | Supported | diamond gradients are radial; gradient strokes are missing | |
effects (drop and inner shadow, layer and background blur), cornerRadius, per-corner radii, clipsContent | Supported | ||
fillStyleId, effectStyleId, textStyleId (and the set…Async forms) | Supported | ||
| Auto layout | layoutMode (NONE, HORIZONTAL, VERTICAL), itemSpacing, counterAxisSpacing, padding*, primaryAxisAlignItems, counterAxisAlignItems, layoutWrap, primaryAxisSizingMode, counterAxisSizingMode | Supported | GRID is reported, not settable |
layoutSizingHorizontal / Vertical, layoutPositioning, layoutGrow, layoutAlign | Supported | ||
| Text | characters, fontSize, fontName, textAlignHorizontal, textAutoResize, letterSpacing, lineHeight, textCase, textDecoration, text fills | Supported | text color is the first solid fill |
loadFontAsync, listAvailableFontsAsync, hasMissingFont | Partial | no font downloads; a short list of common fonts | |
insertCharacters, deleteCharacters, getRange* / setRange* | Partial | whole text only | |
textAlignVertical, paragraphSpacing, hyperlinks, lists, OpenType features | Missing | ||
| Vectors | vectorPaths | Partial | SVG path data; one winding rule per layer |
vectorNetwork | Missing | Proto stores SVG paths | |
| Components | mainComponent, swapComponent, componentProperties, setProperties, detachInstance, variantProperties | Supported | |
componentPropertyDefinitions, addComponentProperty (text, boolean, instance swap) | Partial | editing and deleting definitions is missing | |
importComponentByKeyAsync, team libraries | Missing | ||
| Variables | figma.variables.getLocalVariables(Async), getLocalVariableCollections(Async), getVariableById(Async), getVariableCollectionById(Async) | Supported | |
createVariableCollection, createVariable, variable.setValueForMode, valuesByMode, name, remove, collection.addMode / renameMode / removeMode | Supported | ||
setBoundVariableForPaint, node.setBoundVariable (spacing, padding, radius, opacity, width, height), boundVariables, createVariableAlias | Partial | other fields throw | |
| scopes, code syntax, extended collections | Missing | read as defaults | |
| Styles | getLocalPaintStyles(Async), getLocalTextStyles(Async), getLocalEffectStyles(Async), getStyleById(Async) | Supported | |
createPaintStyle, createTextStyle, createEffectStyle, style.paints / effects / fontSize / fontName / name / remove | Partial | grid styles and other text style fields are missing | |
| Viewport | figma.viewport.center, zoom, bounds, scrollAndZoomIntoView | Partial | scrollAndZoomIntoView shows the first layer |
| UI | figma.showUI (width, height, visible, title), figma.ui.postMessage, onmessage, on / once / off('message'), resize, show, hide, close, __html__, __uiFiles__ | Supported | position and themeColors are ignored |
| Storage | figma.clientStorage.getAsync / setAsync / deleteAsync / keysAsync | Supported | 5 MB per plugin |
| Network | fetch in the main code | Supported | only for approved, allowed domains (see Safety) |
| Manifest | name, id, api, main, ui (file or map), editorType (figma), networkAccess, menu (commands, submenus) | Supported | |
parameters, permissions, capabilities, relaunchButtons, enableProposedApi, widgets, FigJam- or Dev-Mode-only plugins | Missing | warned about or refused at install |
For developers#
app/src/engine/proto/plugins/runtime.js: thefigmaglobal (pure, self-contained, serialized into the worker). It keeps a mirror of the design from the host's snapshot, applies writes to it immediately and records them as engine operations, sent in one batch per task (setTimeout 0) or atfigma.commitUndo().bridge.js: the host side (pure): applies batches through a callback as one undo step, allows only the operations inPLUGIN_OPS, answers storage and network requests, sends snapshots on selection, page and document changes, and enforces the size limits.manifest.js: manifest validation, commands, the network allowlist (allowedUrl) and the UI frame's policy.app/src/proto/plugins/host.js: the sandboxed frames, the UI window, installation (folder, ZIP), the Plugins dialog and the commands incommands/proto.js.- Tests:
tests/proto/plugins/runs self-written plugins in Node through the same runtime and bridge in a separatevmcontext (shapes and auto layout, renaming the selection, tree operations, a UI round trip, fonts and undo steps, variables and client storage, components and variants, network rules, hostile messages, events).
The API was implemented from Figma's public Plugin API documentation and the MIT-licensed @figma/plugin-typings
as an interface reference; no Figma code is used (clean-room.md).
Edit on GitHub → docs/figma-plugins.md