Skip to main content
Heath_Flohre
New Participant
April 5, 2025
Question

Trouble returning the variable id of bound variables on text layers

  • April 5, 2025
  • 1 reply
  • 84 views

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!

This topic has been closed for replies.

1 reply

tank666
April 6, 2025

I answered you in this thread:

 

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank