Skip to main content
Question

Trouble returning the variable id of bound variables on text layers

  • April 5, 2025
  • 1 reply
  • 25 views

Heath_Flohre

I’m trying to retrieve the variable ids bounded to a text layer so I can use theirs names for documentation. I’m successful on shape and frame layers getting the ids of bounded variables for color, radius, and other properties using

let variableId = node.fills[0].boundVariables.color.id;

let variableName = figma.variables.getVariableById(variableId).name;

return variableName;

or 

let variableId = node.boundVariables.topRightRadius.id;

let variableName = figma.variables.getVariableById(variableId).name;

return variableName;

but using 

let variableId = node.boundVariables.fontFamily.id;

let variableName = figma.variableId.getVariableById(variableId).name;

return variableName;

only returns undefined. Inspecting it further, let variableId = node.boundVariables.fontFamily; returns the variable array, like [{"type":"VARIABLE_ALIAS","id":"VariableID:46003:232"}], but I can’t seem to isolate the id value. Thanks for the help!

1 reply

tank666
  • 4873 replies
  • April 6, 2025

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings