Plugin API Index
Full typings: plugin-api-standalone.d.ts (11,292 lines) Grep by symbol name to jump to definition. All L# line numbers refer to that file.
figma.\* — PluginAPI (L24)
Identity & State
| Member | Type |
|---|
apiVersion | '1.0.0' |
editorType | `'figma' \ | 'figjam' \ | 'dev' \ | 'slides' \ | 'buzz'` |
mode | `'default' \ | 'textreview' \ | 'inspect' \ | 'codegen' \ | 'linkpreview' \ | 'auth'` |
fileKey | `string \ | undefined` |
root | DocumentNode |
currentPage | PageNode — assign via setCurrentPageAsync |
currentUser | `User \ | null` |
mixed | unique symbol — sentinel for mixed values in selection |
skipInvisibleInstanceChildren | boolean |
Navigation & Lookup
| Method | Returns |
|---|
setCurrentPageAsync(page) | Promise<void> — MUST use this; sync setter throws |
getNodeByIdAsync(id) | `Promise<BaseNode \ | null>` |
getNodeById(id) | `BaseNode \ | null` |
getStyleByIdAsync(id) | `Promise<BaseStyle \ | null>` |
getStyleById(id) | `BaseStyle \ | null` |
Create Nodes
| Method | Returns |
|---|
createFrame() | FrameNode |
createComponent() | ComponentNode |
createComponentFromNode(node) | ComponentNode |
createRectangle() | RectangleNode |
createEllipse() | EllipseNode |
createLine() | LineNode |
createPolygon() | PolygonNode |
createStar() | StarNode |
createVector() | VectorNode |
createText() | TextNode |
createSection() | SectionNode |
createPage() | PageNode |
createSlice() | SliceNode |
createBooleanOperation() | BooleanOperationNode |
createTable(rows?, cols?) | TableNode |
createImage(data: Uint8Array) | Image |
createNodeFromSvg(svg) | FrameNode |
createNodeFromJSXAsync(jsx) | Promise<SceneNode> |
importComponentByKeyAsync(key) | Promise<ComponentNode> |
importComponentSetByKeyAsync(key) | Promise<ComponentSetNode> |
importStyleByKeyAsync(key) | Promise<BaseStyle> |
Styles (Local)
| Method | Returns |
|---|
createPaintStyle() | PaintStyle |
createTextStyle() | TextStyle |
createEffectStyle() | EffectStyle |
createGridStyle() | GridStyle |
getLocalPaintStyles() / Async | PaintStyle[] |
getLocalTextStyles() / Async | TextStyle[] |
getLocalEffectStyles() / Async | EffectStyle[] |
getLocalGridStyles() / Async | GridStyle[] |
Fonts
| Method | Notes |
|---|
loadFontAsync(fontName) | MUST call before any text edit |
listAvailableFontsAsync() | Promise<Font[]> |
hasMissingFont | boolean |
Plugin Lifecycle
| Method | Notes |
|---|
closePlugin(message?) | Auto-called; use return instead to pass results back |
closePluginWithFailure(message?) | Auto-called on errors; do not call manually |
commitUndo() | Snapshot to undo history |
triggerUndo() | Revert to last snapshot |
saveVersionHistoryAsync(title, desc?) | Promise<VersionHistoryResult> |
notify(message, options?) | throws "not implemented" in use_figma — do not use |
openExternal(url) | Opens URL in browser |
Sub-APIs (properties on figma)
| Property | Interface | L# |
|---|
figma.variables | VariablesAPI | L2016 |
figma.ui | UIAPI | L2604 |
figma.util | UtilAPI | L2691 |
figma.constants | ConstantsAPI | L2809 |
figma.clientStorage | ClientStorageAPI | L2531 |
figma.viewport | ViewportAPI | L3086 |
figma.parameters | ParametersAPI | L3292 |
figma.teamLibrary | TeamLibraryAPI | L2372 |
figma.annotations | AnnotationsAPI | L2187 |
figma.codegen | CodegenAPI | L2871 |
figma.textreview? | TextReviewAPI | L3166 |
figma.payments? | PaymentsAPI | L2420 |
figma.buzz | BuzzAPI | L2211 |
figma.timer? | TimerAPI (FigJam only) | L3053 |
VariablesAPI — figma.variables (L2016)
getVariableByIdAsync(id) Promise<Variable | null> ← preferred; sync deprecated
getVariableCollectionByIdAsync(id) Promise<VariableCollection | null> ← preferred; sync deprecated
getLocalVariablesAsync(type?) Promise<Variable[]> ← preferred; filter by VariableResolvedDataType; sync deprecated
getLocalVariableCollectionsAsync() Promise<VariableCollection[]> ← preferred; sync deprecated
createVariable(name, collection, type) Variable
createVariableCollection(name) VariableCollection
createVariableAlias(variable) VariableAlias
importVariableByKeyAsync(key) Promise<Variable>
setBoundVariableForPaint(paint, field, variable) → returns NEW paint — reassign
setBoundVariableForEffect(effect, field, variable) → returns NEW effect — reassign
setBoundVariableForLayoutGrid(grid, field, variable)
Variable (L10204): name, resolvedType, codeSyntax, scopes, hiddenFromPublishing, valuesByMode, variableCollectionId
setVariableCodeSyntax(platform, value) — platform: 'WEB' | 'ANDROID' | 'iOS'setValueForMode(collectionId, modeId, value)remove()
VariableCollection (L10418): name, modes, variableIds, defaultModeId, hiddenFromPublishing
addMode(name) → modeId; removeMode(modeId); renameMode(modeId, name)
Node Types
Concrete Scene Nodes
| Node | L# | Key characteristics |
|---|
DocumentNode | L8960 | Root; children: PageNode[] |
PageNode | L9119 | children, local styles, backgrounds |
FrameNode | L9311 | DefaultFrameMixin — auto-layout, clips, children |
GroupNode | L9321 | Children only, no auto-layout |
ComponentNode | L9678 | Like Frame + publishable |
ComponentSetNode | L9653 | Variant set container |
InstanceNode | L9719 | Like Frame; mainComponent, detach() |
RectangleNode | L9378 | DefaultShapeMixin + corners |
EllipseNode | L9410 | + arcData |
LineNode | L9396 | |
PolygonNode | L9430 | |
StarNode | L9450 | |
VectorNode | L9476 | Vector paths |
TextNode | L9493 | Rich text, fonts, segments |
TextPathNode | L9564 | Text along path |
BooleanOperationNode | L9792 | booleanOperation property |
SliceNode | L9368 | Export only |
SectionNode | L10754 | Grouping + fills |
TableNode | L9862 | TableCellNode children |
FigJam only: StickyNode L9812, ConnectorNode L10121, ShapeWithTextNode L9999, StampNode L9838, CodeBlockNode L10080, EmbedNode L10661, LinkUnfurlNode L10701, MediaNode L10721
Slides only: SlideNode L10784, SlideRowNode L10809, SlideGridNode L10822
Union types:
type SceneNode (L10917) = FrameNode | GroupNode | SliceNode | RectangleNode | LineNode
| EllipseNode | PolygonNode | StarNode | VectorNode | TextNode | ComponentSetNode
| ComponentNode | InstanceNode | BooleanOperationNode | SectionNode | ...
type BaseNode (L10913) = DocumentNode | PageNode | SceneNode
Mixin Interfaces
| Mixin | L# | Provides |
|---|
BaseNodeMixin | L5284 | id, name, type, parent, remove(), plugin data |
SceneNodeMixin | L5561 | visible, locked, opacity, variable bindings |
ChildrenMixin | L5773 | children, appendChild(), insertChild(), findAll(), findOne(), findAllWithCriteria() |
LayoutMixin | L6135 | x, y, width, height, rotation, resize(), rescale() |
AutoLayoutMixin | L6436 | layoutMode, axis alignment, padding, itemSpacing, layoutSizingHorizontal/Vertical |
AutoLayoutChildrenMixin | L7064 | layoutAlign, layoutGrow, sizing — set AFTER appendChild() |
GridLayoutMixin | L6939 | CSS Grid tracks, gap, template |
GridChildrenMixin | L7127 | grid child positioning |
GeometryMixin | L7485 | fills, strokes, strokeWeight, strokeAlign |
MinimalFillsMixin | L7328 | fills only |
MinimalStrokesMixin | L7246 | strokes, strokeWeight |
BlendMixin | L6339 | opacity, blendMode, isMask, effects |
CornerMixin | L7537 | cornerRadius, cornerSmoothing |
RectangleCornerMixin | L7560 | Per-corner radii |
ExportMixin | L7577 | exportSettings, exportAsync() |
ReactionMixin | L7704 | reactions (prototyping) |
PublishableMixin | L7875 | description, key, getPublishStatusAsync() |
VariantMixin | L8182 | variantProperties |
ComponentPropertiesMixin | L8229 | componentProperties, addComponentProperty() |
PluginDataMixin | L5443 | getSharedPluginData(), setSharedPluginData() supported; getPluginData(), setPluginData() NOT supported |
FramePrototypingMixin | L7651 | overflowDirection, numberOfFixedChildren |
BaseFrameMixin | L7939 | ChildrenMixin + LayoutMixin + AutoLayoutMixin + GeometryMixin + … |
DefaultFrameMixin | L7997 | BaseFrameMixin + FramePrototypingMixin + ReactionMixin |
DefaultShapeMixin | L7928 | BlendMixin + GeometryMixin + LayoutMixin + ExportMixin + ReactionMixin |
ExplicitVariableModesMixin | L9084 | setExplicitVariableModeForCollection() |
Paint & Fill (L4302)
| Type | L# | Notes |
|---|
SolidPaint | L4302 | type:'SOLID', color: RGB, opacity, visible, blendMode |
GradientPaint | L4357 | `type: 'GRADIENT_LINEAR\ | RADIAL\ | ANGULAR\ | DIAMOND', gradientStops: ColorStop[]` |
ImagePaint | L4377 | type:'IMAGE', imageHash, scaleMode |
VideoPaint | L4413 | type:'VIDEO' |
PatternPaint | L4449 | type:'PATTERN' |
type Paint | L4481 | Union of all five |
ColorStop | L4271 | { position: number, color: RGBA } |
ImageFilters | L4290 | exposure, contrast, saturation, etc. |
CRITICAL: Fills/strokes are read-only arrays — clone, modify, reassign.
Effects (L3966)
| Type | L# |
|---|
DropShadowEffect | L3966 |
InnerShadowEffect | L4009 |
BlurEffect (Normal/Progressive) | L4048 |