Skip to main content
Question

"Variable value doesn't map to variant"

  • December 1, 2023
  • 11 replies
  • 2879 views

Leander_Nelissen

I have been playing around with variable prototyping, but sometimes when I assign a variable to a variant, I get this popup. Does anybody know what this means and how I can fix it?

This topic has been closed for replies.

11 replies

ksn
Figmate
  • Community Support
  • 2046 replies
  • December 1, 2023

@Leander_Nelissen hmm – are you able to share a copy of this particular file your screenshot is from? I think support would be best to answer this after looking. I’m not sure what’s triggering that message directly on my end.

You can create a ticket here, and someone will review + let you know what’s going on: https://help.figma.com/hc/en-us/requests/new?ticket_form_id=360001744374


  • 1 reply
  • December 8, 2023

I found this same issue.
It was caused by the boolean property in the variant (“Show” in your case) being set to “Yes”/“No”, but the boolean variable is usually “True”/“False” - so go ahead into the Keyboard and make sure you use True / False


Atiyah_Thomas

Was this issue resolved having the same issue.


Leander_Nelissen

Yes, just use True/false instead of yes/no


Sakky_Baral
  • 1 reply
  • January 23, 2024

Lifesaver!!!


Zohar_Uziely
  • New Member
  • 2 replies
  • June 6, 2024

I used boolean variable, but it still doesn’t work (it have to be true/false, I have no option to change it but it still doesn’t work)

variables:
image

in the component:
image


Gayani_S
Figmate
  • Community Support
  • 2383 replies
  • June 10, 2024

Hey everyone, I am checking this internally with the team. Would appreciate it, if anyone is able to provide a direct link to the file and invite support-share@figma.com with “can edit” permission so we can look into this further? Note that users with @figma.com emails on your team do not count towards your billing.

Thanks!


@Zohar_Uziely True/False should be set for the property in the main component (in your case for property “Selected”).

It seems that Figma can convert any variant with values (yes/no or on/off or smth similar) into a boolean property, but keeps under the hood these initially provided text strings(eg yes/no) and when you try to match Boolean variable and such a boolean property of the component, looks like Figma under the hood still tries to match text strings and for Boolean variable it’s a True/False and for your component it’s Yes/No(or other wording) - and this is the place where the issue happens


Zohar_Uziely
  • New Member
  • 2 replies
  • June 13, 2024

Great answer! Thank you!!


Niharika_Bankapure

Here’s the solution to this issue: In the main component, ensure the property is set as true or false, not as on or off. For example, use selected=true or selected=false. This should align with the local variable, which should also be a string: “true” or “false”.


Bauke_Schildt
  • Active Member
  • 61 replies
  • April 1, 2025

@PaulUX Found a workaround for when you can’t just change the component (for example, when it’s coming from a library):

You need to create a new string variable when applying a variable (Click on the + in the popover)