Skip to main content
Alex_FG
New Participant
September 1, 2023
Solved

Is it not possible to set a text variable to an empty string?

  • September 1, 2023
  • 11 replies
  • 3775 views

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

This topic has been closed for replies.
Best answer by Alex_FG

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

11 replies

tank666
November 4, 2024
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.

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