Skip to main content
Question

How can I retrieve the bound variable ID for the characters property on an instance?

  • February 12, 2025
  • 1 reply
  • 50 views

je.song

Hi everyone,

I'm working on a Figma plugin using variables, and I've encountered an issue with variable binding information on instances. Here's my situation:

  1. For a component (the main/original component) that has its characters property bound to a string variable, I can successfully retrieve the binding details. For example, using:

    • node.boundVariables['characters'] returns an object with binding information (including the variable alias).
    • Then, using await figma.variables.getVariableByIdAsync(variableId), I can get the variable details (and see a variableDetails structure, including the variable ID and mode-specific values).
  2. However, when I create an instance of that component and bind its characters property to a variable, the resulting instance's characters property resolves to the overridden string value (e.g., "Share Link Open") and the boundVariables object does not include a key for "characters". In other words, I cannot see the variable binding details (or the variable ID) for the instance's characters.

My questions are:

  • Is my understanding correct that, while the original component exposes its variable binding details (via boundVariables["characters"] and its variableDetails), an instance does not expose this information?
  • If so, is there any method or workaround available to retrieve the bound variable ID (and its mode-specific values) for the characters property on an instance? I need to know which variable from the local variables collection is bound to the instance's characters, since I can't simply refer to the mainComponent's binding (they can differ).

Any insights or suggestions would be greatly appreciated!

Thanks in advance.

tank666
  • February 12, 2025

Could you add more details? It's not clear from the description what the component structure is, or what exactly the variable is bound to (the value of the component's text property or the text node itself). It would be great if you could provide a link to a test file so anyone could check it out.


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