Skip to main content
Question

API for Unbinding Missing Variables from Styles


Mastro
  • New Participant
  • 6 replies
I'm developing a Figma plugin that scans and fixes styles with missing variable references. However, I can't find a way to unbind variables without recreating styles, which breaks library references.
My current approach is to save style properties, create a new clean style, and delete the original - but this breaks all external references when using libraries.
  1. Is there a method to remove variable bindings without recreating styles?
  2. Can textStyle.setBoundVariable(propertyName, null) work for unbinding?
  3. Any plans to implement proper unbinding functionality?
This is critical for design systems when variables are renamed or removed. Any insights would be appreciated!

7 replies

sidnioulz
  • New Member
  • 2 replies
  • March 20, 2025

We’ve needed that in my team and had to buy a variable cleaning plugin and go over every file manually. I know of other teams that have had the issue, from discussing with a Figma advocate. Having an API option to clean up those untethered variables would be a game changer.


Mastro
  • Author
  • New Participant
  • 6 replies
  • March 20, 2025
sidnioulz wrote:

We’ve needed that in my team and had to buy a variable cleaning plugin and go over every file manually. I know of other teams that have had the issue, from discussing with a Figma advocate. Having an API option to clean up those untethered variables would be a game changer.

Hi and thanks for your reply!

So, you paid for a plugin that at the end couldn’t do the job, am I right? Do you remember the plugin’s name?

I did look for some plugins but they essentially detach all variable or style from a selected frame or layer, and that’s not what I’m looking for to develop. I’m talking about variable tokens that are apply with relative values, to other “Local styles”, so they’re not actually applied to a frame but they could recall tokens, from variables from collections, which are not available anymore.

Probably it’s the same use-case you’re having.


furqanhamid
  • New Participant
  • 5 replies
  • March 20, 2025

This is important for maintaining design system integrity! Unfortunately, unbinding without recreating styles isn’t natively supported yet. setBoundVariable(propertyName, null) might work, but an official unbinding method would be ideal—hopefully, Figma adds support soon!


Avery Frankenberg

Hi from Figma! Thanks so much for reaching out with your questions! Hope these answers help!

  1. Unfortunately, this is not possible. A subscribed/library style is immutable and there is no way to modify to remove variable references without recreating the style. If there is a style with missing or dangling references, the style should be fixed/republished from the source file itself. Once the style is updated, you will have to manually accept those updates in the relevant files.
  2. This will work for local styles! It will not work for subscribed styles though because those cannot be modified.
  3. There are no plans at this point to update the API, but we will track this in our backlog for future improvements.

Mastro
  • Author
  • New Participant
  • 6 replies
  • March 21, 2025

 

Hi ​@Avery Frankenberg thank you very much for your reply. 

I believe this answer has gone beyond my expectations and requests. I would tend to develop a plugin that can automatically do the "Detach Variable" (the icon with the broke chain) which is currently only manual for those tokens references that are no longer available, as in the case highlighted.

So far with my plugin and Figma’s API, I have succeeded to find the styles that have tokens that recall variables no longer available, what I miss is that functionality of "Detach Variable" maintaining the value that was once assigned, which is exactly what happens by doing  that detach manually.


Avery Frankenberg

Hi Mastro! 

Thanks for your response. It would be helpful to get an example to better assist you. If you’re talking about subscribed styles, the style edit modal (and the detach buttons associated with it) isn't available in the UI anyway. 

 

Thanks!


Mastro
  • Author
  • New Participant
  • 6 replies
  • March 24, 2025
Avery Frankenberg wrote:

Hi Mastro! 

Thanks for your response. It would be helpful to get an example to better assist you. If you’re talking about subscribed styles, the style edit modal (and the detach buttons associated with it) isn't available in the UI anyway. 

 

Thanks!

Correct I’m talking about that modal that opens to edit a style. What you mean by “isn’t available in the UI anyway”, that is not possible to access to those options via API?


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