Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Official Figma skill for writing directly to the Figma canvas through the MCP server and Plugin API.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
plugin-api-standalone.index.md
1# Plugin API Index23> Full typings: `plugin-api-standalone.d.ts` (11,292 lines)4> Grep by symbol name to jump to definition. All `L#` line numbers refer to that file.56---78## figma.\* — PluginAPI (L24)910### Identity & State1112| Member | Type |13| ------------------------------- | -------------------------------------------------------------------------------- |14| `apiVersion` | `'1.0.0'` |15| `editorType` | `'figma' \| 'figjam' \| 'dev' \| 'slides' \| 'buzz'` |16| `mode` | `'default' \| 'textreview' \| 'inspect' \| 'codegen' \| 'linkpreview' \| 'auth'` |17| `fileKey` | `string \| undefined` |18| `root` | `DocumentNode` |19| `currentPage` | `PageNode` — assign via `setCurrentPageAsync` |20| `currentUser` | `User \| null` |21| `mixed` | `unique symbol` — sentinel for mixed values in selection |22| `skipInvisibleInstanceChildren` | `boolean` |2324### Navigation & Lookup2526| Method | Returns |27| --------------------------- | ------------------------------------------------------- |28| `setCurrentPageAsync(page)` | `Promise<void>` — **MUST use this**; sync setter throws |29| `getNodeByIdAsync(id)` | `Promise<BaseNode \| null>` |30| `getNodeById(id)` | `BaseNode \| null` |31| `getStyleByIdAsync(id)` | `Promise<BaseStyle \| null>` |32| `getStyleById(id)` | `BaseStyle \| null` |3334### Create Nodes3536| Method | Returns |37| ----------------------------------- | --------------------------- |38| `createFrame()` | `FrameNode` |39| `createComponent()` | `ComponentNode` |40| `createComponentFromNode(node)` | `ComponentNode` |41| `createRectangle()` | `RectangleNode` |42| `createEllipse()` | `EllipseNode` |43| `createLine()` | `LineNode` |44| `createPolygon()` | `PolygonNode` |45| `createStar()` | `StarNode` |46| `createVector()` | `VectorNode` |47| `createText()` | `TextNode` |48| `createSection()` | `SectionNode` |49| `createPage()` | `PageNode` |50| `createSlice()` | `SliceNode` |51| `createBooleanOperation()` | `BooleanOperationNode` |52| `createTable(rows?, cols?)` | `TableNode` |53| `createImage(data: Uint8Array)` | `Image` |54| `createNodeFromSvg(svg)` | `FrameNode` |55| `createNodeFromJSXAsync(jsx)` | `Promise<SceneNode>` |56| `importComponentByKeyAsync(key)` | `Promise<ComponentNode>` |57| `importComponentSetByKeyAsync(key)` | `Promise<ComponentSetNode>` |58| `importStyleByKeyAsync(key)` | `Promise<BaseStyle>` |5960### Styles (Local)6162| Method | Returns |63| ---------------------------------- | --------------- |64| `createPaintStyle()` | `PaintStyle` |65| `createTextStyle()` | `TextStyle` |66| `createEffectStyle()` | `EffectStyle` |67| `createGridStyle()` | `GridStyle` |68| `getLocalPaintStyles()` / `Async` | `PaintStyle[]` |69| `getLocalTextStyles()` / `Async` | `TextStyle[]` |70| `getLocalEffectStyles()` / `Async` | `EffectStyle[]` |71| `getLocalGridStyles()` / `Async` | `GridStyle[]` |7273### Fonts7475| Method | Notes |76| --------------------------- | ---------------------------------- |77| `loadFontAsync(fontName)` | **MUST call before any text edit** |78| `listAvailableFontsAsync()` | `Promise<Font[]>` |79| `hasMissingFont` | `boolean` |8081### Plugin Lifecycle8283| Method | Notes |84| --------------------------------------- | ------------------------------------------------------------ |85| `closePlugin(message?)` | Auto-called; use `return` instead to pass results back |86| `closePluginWithFailure(message?)` | Auto-called on errors; do not call manually |87| `commitUndo()` | Snapshot to undo history |88| `triggerUndo()` | Revert to last snapshot |89| `saveVersionHistoryAsync(title, desc?)` | `Promise<VersionHistoryResult>` |90| `notify(message, options?)` | **throws "not implemented" in use_figma — do not use** |91| `openExternal(url)` | Opens URL in browser |9293### Sub-APIs (properties on figma)9495| Property | Interface | L# |96| --------------------- | ------------------------ | ----- |97| `figma.variables` | `VariablesAPI` | L2016 |98| `figma.ui` | `UIAPI` | L2604 |99| `figma.util` | `UtilAPI` | L2691 |100| `figma.constants` | `ConstantsAPI` | L2809 |101| `figma.clientStorage` | `ClientStorageAPI` | L2531 |102| `figma.viewport` | `ViewportAPI` | L3086 |103| `figma.parameters` | `ParametersAPI` | L3292 |104| `figma.teamLibrary` | `TeamLibraryAPI` | L2372 |105| `figma.annotations` | `AnnotationsAPI` | L2187 |106| `figma.codegen` | `CodegenAPI` | L2871 |107| `figma.textreview?` | `TextReviewAPI` | L3166 |108| `figma.payments?` | `PaymentsAPI` | L2420 |109| `figma.buzz` | `BuzzAPI` | L2211 |110| `figma.timer?` | `TimerAPI` (FigJam only) | L3053 |111112---113114## VariablesAPI — figma.variables (L2016)115116```117getVariableByIdAsync(id) Promise<Variable | null> ← preferred; sync deprecated118getVariableCollectionByIdAsync(id) Promise<VariableCollection | null> ← preferred; sync deprecated119getLocalVariablesAsync(type?) Promise<Variable[]> ← preferred; filter by VariableResolvedDataType; sync deprecated120getLocalVariableCollectionsAsync() Promise<VariableCollection[]> ← preferred; sync deprecated121createVariable(name, collection, type) Variable122createVariableCollection(name) VariableCollection123createVariableAlias(variable) VariableAlias124importVariableByKeyAsync(key) Promise<Variable>125setBoundVariableForPaint(paint, field, variable) → returns NEW paint — reassign126setBoundVariableForEffect(effect, field, variable) → returns NEW effect — reassign127setBoundVariableForLayoutGrid(grid, field, variable)128```129130**Variable (L10204):** `name`, `resolvedType`, `codeSyntax`, `scopes`, `hiddenFromPublishing`, `valuesByMode`, `variableCollectionId`131132- `setVariableCodeSyntax(platform, value)` — platform: `'WEB' | 'ANDROID' | 'iOS'`133- `setValueForMode(collectionId, modeId, value)`134- `remove()`135136**VariableCollection (L10418):** `name`, `modes`, `variableIds`, `defaultModeId`, `hiddenFromPublishing`137138- `addMode(name)` → `modeId`; `removeMode(modeId)`; `renameMode(modeId, name)`139140---141142## Node Types143144### Concrete Scene Nodes145146| Node | L# | Key characteristics |147| ---------------------- | ------ | -------------------------------------------------- |148| `DocumentNode` | L8960 | Root; `children: PageNode[]` |149| `PageNode` | L9119 | `children`, local styles, `backgrounds` |150| `FrameNode` | L9311 | `DefaultFrameMixin` — auto-layout, clips, children |151| `GroupNode` | L9321 | Children only, no auto-layout |152| `ComponentNode` | L9678 | Like Frame + publishable |153| `ComponentSetNode` | L9653 | Variant set container |154| `InstanceNode` | L9719 | Like Frame; `mainComponent`, `detach()` |155| `RectangleNode` | L9378 | `DefaultShapeMixin` + corners |156| `EllipseNode` | L9410 | + `arcData` |157| `LineNode` | L9396 | |158| `PolygonNode` | L9430 | |159| `StarNode` | L9450 | |160| `VectorNode` | L9476 | Vector paths |161| `TextNode` | L9493 | Rich text, fonts, segments |162| `TextPathNode` | L9564 | Text along path |163| `BooleanOperationNode` | L9792 | `booleanOperation` property |164| `SliceNode` | L9368 | Export only |165| `SectionNode` | L10754 | Grouping + fills |166| `TableNode` | L9862 | `TableCellNode` children |167168**FigJam only:** `StickyNode` L9812, `ConnectorNode` L10121, `ShapeWithTextNode` L9999, `StampNode` L9838, `CodeBlockNode` L10080, `EmbedNode` L10661, `LinkUnfurlNode` L10701, `MediaNode` L10721169170**Slides only:** `SlideNode` L10784, `SlideRowNode` L10809, `SlideGridNode` L10822171172**Union types:**173174```175type SceneNode (L10917) = FrameNode | GroupNode | SliceNode | RectangleNode | LineNode176| EllipseNode | PolygonNode | StarNode | VectorNode | TextNode | ComponentSetNode177| ComponentNode | InstanceNode | BooleanOperationNode | SectionNode | ...178type BaseNode (L10913) = DocumentNode | PageNode | SceneNode179```180181---182183## Mixin Interfaces184185| Mixin | L# | Provides |186| ---------------------------- | ----- | ----------------------------------------------------------------------------------------------- |187| `BaseNodeMixin` | L5284 | `id`, `name`, `type`, `parent`, `remove()`, plugin data |188| `SceneNodeMixin` | L5561 | `visible`, `locked`, `opacity`, variable bindings |189| `ChildrenMixin` | L5773 | `children`, `appendChild()`, `insertChild()`, `findAll()`, `findOne()`, `findAllWithCriteria()` |190| `LayoutMixin` | L6135 | `x`, `y`, `width`, `height`, `rotation`, `resize()`, `rescale()` |191| `AutoLayoutMixin` | L6436 | `layoutMode`, axis alignment, padding, `itemSpacing`, `layoutSizingHorizontal/Vertical` |192| `AutoLayoutChildrenMixin` | L7064 | `layoutAlign`, `layoutGrow`, sizing — **set AFTER `appendChild()`** |193| `GridLayoutMixin` | L6939 | CSS Grid tracks, gap, template |194| `GridChildrenMixin` | L7127 | grid child positioning |195| `GeometryMixin` | L7485 | `fills`, `strokes`, `strokeWeight`, `strokeAlign` |196| `MinimalFillsMixin` | L7328 | `fills` only |197| `MinimalStrokesMixin` | L7246 | `strokes`, `strokeWeight` |198| `BlendMixin` | L6339 | `opacity`, `blendMode`, `isMask`, `effects` |199| `CornerMixin` | L7537 | `cornerRadius`, `cornerSmoothing` |200| `RectangleCornerMixin` | L7560 | Per-corner radii |201| `ExportMixin` | L7577 | `exportSettings`, `exportAsync()` |202| `ReactionMixin` | L7704 | `reactions` (prototyping) |203| `PublishableMixin` | L7875 | `description`, `key`, `getPublishStatusAsync()` |204| `VariantMixin` | L8182 | `variantProperties` |205| `ComponentPropertiesMixin` | L8229 | `componentProperties`, `addComponentProperty()` |206| `PluginDataMixin` | L5443 | `getSharedPluginData()`, `setSharedPluginData()` supported; `getPluginData()`, `setPluginData()` **NOT supported** |207| `FramePrototypingMixin` | L7651 | `overflowDirection`, `numberOfFixedChildren` |208| `BaseFrameMixin` | L7939 | ChildrenMixin + LayoutMixin + AutoLayoutMixin + GeometryMixin + … |209| `DefaultFrameMixin` | L7997 | BaseFrameMixin + FramePrototypingMixin + ReactionMixin |210| `DefaultShapeMixin` | L7928 | BlendMixin + GeometryMixin + LayoutMixin + ExportMixin + ReactionMixin |211| `ExplicitVariableModesMixin` | L9084 | `setExplicitVariableModeForCollection()` |212213---214215## Paint & Fill (L4302)216217| Type | L# | Notes |218| --------------- | ----- | --------------------------------------------------------------------------------- |219| `SolidPaint` | L4302 | `type:'SOLID'`, `color: RGB`, `opacity`, `visible`, `blendMode` |220| `GradientPaint` | L4357 | `type: 'GRADIENT_LINEAR\|RADIAL\|ANGULAR\|DIAMOND'`, `gradientStops: ColorStop[]` |221| `ImagePaint` | L4377 | `type:'IMAGE'`, `imageHash`, `scaleMode` |222| `VideoPaint` | L4413 | `type:'VIDEO'` |223| `PatternPaint` | L4449 | `type:'PATTERN'` |224| `type Paint` | L4481 | Union of all five |225| `ColorStop` | L4271 | `{ position: number, color: RGBA }` |226| `ImageFilters` | L4290 | exposure, contrast, saturation, etc. |227228> **CRITICAL**: Fills/strokes are **read-only arrays** — clone, modify, reassign.229230---231232## Effects (L3966)233234| Type | L# |235| ---------------------------------- | ----- |236| `DropShadowEffect` | L3966 |237| `InnerShadowEffect` | L4009 |238| `BlurEffect` (Normal/Progressive) | L4048