Skip to main content

I can set it to ’ ’ (a space), or any string with text in it, but nothing happens if the value I give it is ‘’.

nvm it’s a bug on my end 🤓


Hey! How did you fixed it? I have the same problem 😦


I think I was setting it to null instead of ‘’. Setting it to ‘’ worked.


Hello! Which ASCII character are you referring to as ‘’? Right now, I can only set it to a whitespace for the variable to appear as empty (although it isn’t, since it’s a whitespace and has a length of one)

Captura de pantalla 2024-01-06 172436


You need to set it to an empty string without any character.


variable = '';

Oh, is that using the API? Or is there a way using the keyboard? Because if the variable is set to a whitespace and I delete it and press intro, the variable resets to the whitespace. Similarly, if I create a new text variable, which by default is set to “String value” and I try to delete that completely and press intro, the variable resets to “String value”


So weird


Only using the Plugin API. I wrote about it here:


Hey, I am not able to do it. Can you explain it a bit more ? How do I set a string’s value as null



You cannot set null as a value for a string variable. Instead of null, you must specify an empty string.


variable.setValueForMode(modeId, '')

Hi, could you share the full code that you added on Run plugin API to set a String variable empty?


const collection = figma.variables.createVariableCollection('New collection'),
modeId = collection.defaultModeId,
variable = figma.variables.createVariable('New string variable', collection, 'STRING');

variable.setValueForMode(modeId, '');

This code will create a new collection with a variable with an empty value.


Reply