'No' / 'Yes' variants, after being automatically converted to boolean, are still treated as string, stopping boolean variables binded to an instance from working

I couldn’t find a bug report, so just in case I’m posting my own.

If we create a component with ‘No’ / ‘Yes’ variants (which Figma transform automagically into boolean) and we bind variable to that it’s not working. Since it shows as a boolean we can only bind boolean variable, but when we do that the variable name is crossed out and it’s not working.

I suspect it happens because Figma still treats that variant as a ‘string’. If I change variant names to something else (so it’s not transformed into boolean) and I use string variable it’s working just fine.

Hi @n_zrk, Thank you for reaching out regarding boolean property and string variables. We appreciate your insights and troubleshooting on this issue.

While I may not fully grasp your situation, I conducted a test on my end and was able to attach a string variable to the text layer nested within the instance that has a boolean property.

For more detailed information, you can refer to: Apply variables to designs

I hope this information proves helpful, but there’s a possibility that I may have overlooked something…
If that’s the case, could you please provide a brief video recording demonstrating the issue? Kindly show the full Figma screen, including the left and right panels, to display the exact names of the layers and properties. This visual aid will greatly assist the community in understanding the issue and enable us to replicate the behavior for further analysis.

If any members of our community have encountered a similar issue and have suggestions or workarounds, please do not hesitate to share them!

Thanks,

Hey @Junko3!

That’s not the case I was describing. Let me provide the video to be more clear.
If you create a component with variant values named No and Yes, Figma will automatically change it into a boolean toggle. You can attach a variable to this boolean, but Figma only allows to use boolean variable there while (this is my assumption) it still treats it as a string (No / Yes named variants). As a result attached boolean variable is not working. The example you provided is not using variants, it’s using a component boolean property which is a different case.

Hi @n_zrk, Thank you for pointing that out! I really appreciate you sharing helpful information and recording with us.

I tried it on my end and I was able to replicate the same issue where setting variant property values as [Yes] and [No] shows a boolean toggle for that instance property but doesn’t allow attaching boolean variables.

I think this behavior might be because the boolean variable value(True/False) doesn’t match the variant property values(Yes/No). For example, when setting variant property values as [True] and [False], you can attach boolean variables to the instance toggle.

However, I totally understand that this can be confusing. I have raised this concern internally and will update you as soon as I have more information.

Thank you for your assistance! If there’s anything else I may have missed, please feel free to let us know.
If anyone from our community has insights, please join the conversation!

Thank you,

1 Like

2 posts were split to a new topic: The applied variable appeared with a strikethrough

Hey @Pradyumna1, as your question seems to be drifting a bit from the original post, I will create a new post right after this to assist you.

For anyone encountering this issue. Here is a workaround:
You can’t select a string variable but you can create one by clicking on this plus


Then you can name and create the variable. After that change the text to the matching Component Text.

I’m honestly very suprised that this bug still exists? Why am I not able to bind booleans to Component Names detected as a boolean?

1 Like