VariablesAPI
Defined in: figmaPluginTypes.ts:1876
https://www.figma.com/plugin-docs/api/figma-variables
createVariable(
name,collectionId,resolvedType):Variable
Defined in: figmaPluginTypes.ts:1935
Creates a variable with a given name and resolved type inside a collection.
string
the name of the newly created variable
string
the ID of a collection object
the resolved type of this variable
Use createVariable(string, VariableCollection, VariableResolvedDataType) instead. This function will throw an exception if the plugin manifest contains "documentAccess": "dynamic-page".
createVariable(
name,collection,resolvedType):Variable
Defined in: figmaPluginTypes.ts:1947
Creates a variable with a given name and resolved type inside a collection.
string
the name of the newly created variable
A variable collection. Make sure to pass a collection object here; passing a collection ID is deprecated.
the resolved type of this variable
createVariableAlias(
variable):VariableAlias
Defined in: figmaPluginTypes.ts:1963
Helper function to create a variable alias.
This should be used with functions such as node.setProperties() to
assign component properties to variables.
createVariableAliasByIdAsync(
variableId):Promise<VariableAlias>
Defined in: figmaPluginTypes.ts:1970
Helper function to create a variable alias.
This should be used with functions such as node.setProperties() to
assign component properties to variables.
string
Promise<VariableAlias>
createVariableCollection(
name):VariableCollection
Defined in: figmaPluginTypes.ts:1956
Creates a new variable collection with the given name.
string
the name of the newly created variable collection.
getLocalVariableCollections():
VariableCollection[]
Defined in: figmaPluginTypes.ts:1925
Returns all local variable collections in the current file.
Use VariablesAPI.getLocalVariableCollectionsAsync instead. This function will throw an exception if the plugin manifest contains "documentAccess": "dynamic-page".
getLocalVariableCollectionsAsync():
Promise<VariableCollection[]>
Defined in: figmaPluginTypes.ts:1919
Returns all local variable collections in the current file.
Promise<VariableCollection[]>
getLocalVariables(
type?):Variable[]
Defined in: figmaPluginTypes.ts:1915
Returns all local variables in the current file, optionally filtering by resolved type.
Filters the returned variables to only be of the given resolved type.
Variable[]
Use VariablesAPI.getLocalVariablesAsync instead. This function will throw an exception if the plugin manifest contains "documentAccess": "dynamic-page".
getLocalVariablesAsync(
type?):Promise<Variable[]>
Defined in: figmaPluginTypes.ts:1908
Returns all local variables in the current file, optionally filtering by resolved type.
Filters the returned variables to only be of the given resolved type.
Promise<Variable[]>
getVariableById(
id):null|Variable
Defined in: figmaPluginTypes.ts:1889
Finds a variable by ID. If not found or the provided ID is invalid, returns null.
string
The variable ID to search for, which represents a unique identifier for the variable.
null | Variable
Use VariablesAPI.getVariableByIdAsync instead. This function will throw an exception if the plugin manifest contains "documentAccess": "dynamic-page".
getVariableByIdAsync(
id):Promise<null|Variable>
Defined in: figmaPluginTypes.ts:1882
Finds a variable by ID. If not found or the provided ID is invalid, returns a promise containing null.
string
The variable ID to search for, which represents a unique identifier for the variable.
Promise<null | Variable>
getVariableCollectionById(
id):null|VariableCollection
Defined in: figmaPluginTypes.ts:1902
Finds a variable collection by ID. If not found or the provided ID is invalid, returns null.
string
The variable collection ID to search for, which represents a unique identifier for the variable collection.
null | VariableCollection
Use VariablesAPI.getVariableCollectionByIdAsync instead. This function will throw an exception if the plugin manifest contains "documentAccess": "dynamic-page".
getVariableCollectionByIdAsync(
id):Promise<null|VariableCollection>
Defined in: figmaPluginTypes.ts:1895
Finds a variable collection by ID. If not found or the provided ID is invalid, returns a promise containing null.
string
The variable collection ID to search for, which represents a unique identifier for the variable collection.
Promise<null | VariableCollection>
importVariableByKeyAsync(
key):Promise<Variable>
Defined in: figmaPluginTypes.ts:2013
Loads a variable from the team library. Promise is rejected if there is no published variable with that key or if the request fails.
string
the key of the variable to import.
Promise<Variable>
setBoundVariableForEffect(
effect,field,variable):Effect
Defined in: figmaPluginTypes.ts:1990
Helper function to bind a variable to an Effect.
If null is provided as the variable, the given field will be unbound from any variables.
null | Variable
a copy of the effect which is now bound to the provided variable.
setBoundVariableForLayoutGrid(
layoutGrid,field,variable):LayoutGrid
Defined in: figmaPluginTypes.ts:2002
Helper function to bind a variable to a LayoutGrid.
If null is provided as the variable, the given field will be unbound from any variables.
VariableBindableLayoutGridField
null | Variable
a copy of the layout grid which is now bound to the provided variable.
setBoundVariableForPaint(
paint,field,variable):SolidPaint
Defined in: figmaPluginTypes.ts:1978
Helper function to bind a variable to a SolidPaint.
If null is provided as the variable, the given field will be unbound from any variables.
"color"
null | Variable
a copy of the paint which is now bound to the provided variable.