Skip to main content

Use inverse of Boolean variable to show/hide layer


Thomas_Nabelek

This has been mentioned here:

I am looking for the availability to HIDE a layer when a Boolean variable is TRUE and SHOW it when it is FALSE. So, the inverse of the default/current behavior. I want to do this without using components.

Use case: When a variable is true, show one frame. When that same variable is false, show a different frame.

I can get basically this by using two different variables:


but it would be more convenient to be able to do it with just one. Just give me a Boolean toggle when the variable is used to say if the variable should be inverted or not.

23 replies

y_toku
Figmate
  • Community Support
  • 2419 replies
  • February 29, 2024

Thanks for sharing your idea! we would like to gauge the reaction of other members in the community. We may consider it for future enhancements!

Thanks,
Toku


dv.korzhev

I think it’s useful

I have a checkbox that turns the container on and off on the layout.
Right now I have one variable used to switch the checkbox and the other to display the container

For example:
clicked on the checkbox - the jackdaw is enabled, the container is hidden
, clicked again - the jackdaw is missing, the container is shown

Currently, 2 variables are used for this. I really want to be able to see when the layer is displayed: if true, if false

It seems to me that you had something similar. Maybe it can be simplified somehow? I will be glad to help!)

Frame 5
Frame 5


Laurent_Gaulhiac

I am building a fairly complex app.
To manage the state of the panels, I rely on the Layer Visibility with booleans. I have to set up almost every booleans twice, like:

  • is_EditModeActive?
  • is_EditModeInactive?

Then I need A LOT of conditional branching and twice the amount of “set variables” to achieve what I need.

A simple custom variable defined like is_EditModeInactive? = !{is_EditModeActive?} or a simple “boolean inverter” while right-clicking the “Eye” icon at the Layer level will make complex work WAY easier. Now it’s a nightmare for advanced prototypes.


Would like this too!


andreaszzz

This would make prototyping a lot simpler!


Mark_Koh
  • 1 reply
  • July 9, 2024

This would be very useful for advanced prototyping. The ability to hide something given a state being True seems like it would be pretty common!


Devang_Patel

+1 much needed feature. We should be able to tie inverted boolean variables to visibility property.


Nirmit_Srivastava

Need this ability really.
Spent almost half day trying to hide/unhide multiple layers based on simple interactive checkbox component.
Tried different IF ELSE conditions with my interactive checkbox component which has got two selected states (yes/no), but the ELSE condition, set up set the values of couple of other Boolean variables to true/false, simply does not get triggered at all. The first set of conditions work which are in the IF part.

(I figured its happening because in essence the second checkbox “click” is actually happening on Variant state B of the instance, while the conditional statements are defined “on click” of the variant state A!)


Jules_Doyle

I run into this need pretty much on every project I work on.


Bogdan_Niculae1

Hope the community will upvote more so we can get this feature. I use it a lot in my projects but always with workarounds.


Art_Klepchukov

Every time I play with variables I find limitations like this and end up dropping the entire experiment in favor of more explicit states. So, if you want people to actually adopt variables, especially in prototypes, maybe support more than trivial examples?


Alamaki
  • 48 replies
  • September 4, 2024

Not having this really basic functionality makes boolean variables just about useless. Nearly always when not-showing something, something else should be show.

Not having this this also makes prototype logic unnecessalily complex. Most booleans need an inverse and both need to be constantly set separately. Even when just one boolean will work, it must work on logic that may not make sense in the context of the prototype.


Marie_Rang
  • 9 replies
  • September 11, 2024

Yes this is so annoying - I have so many prototypes that have like 48 variables when I could do it with 12 if only the booleans were reversible.


Tascha
  • Active Member
  • 31 replies
  • September 27, 2024

Chiming in here to say I REALLY need this too 🥲


Onkel_Tem
  • 18 replies
  • November 24, 2024

It felt odd that it was not implemented from the start.

It became ever more odd after the launch of variables expressions: https://help.figma.com/hc/en-us/articles/15253194385943-Use-expressions-in-prototypes
because it affected (in a good sense) the prototyping, but left Designer UI far behind.

Currently if a user wants to use a boolean variable, they have to create TWO of them:

So every Foo var should have aNotFoo mate that is just… a negation of the former.

Not only it doubles the amount of variables, it also doubles the complexity of all interactions: when you set Foo=true, you have to not forget to set NotFoo=false as well.
And since it’s not constrained by anything, designer has to manually watch them to be in sync.

So these two things are highly awaited:

  1. Variable VALUES should allow for expressions

image

Instead of “String value” we need expressions.

  1. Variable USAGES should allow for expressions.

In addition to “Search” we need expressions.


Chris_Gatland
  • New Participant
  • 6 replies
  • December 4, 2024

Yes, I need this too, but more than just reversing I’d love to be able to use multiple variables, like:
Show layer if BOTH Variable A and B are true AND variable C is false.


Simon Carey
  • New Member
  • 1 reply
  • January 15, 2025

I need this too!! 🙏


Mark_White1
  • New Member
  • 2 replies
  • January 20, 2025

+1 
Came here just to see if anyone else was having this same annoyance. Glad its not just me!
Really would like to see this as a simple UI toggle where its needed to save on the increasing number of its on/its off booleans.
Please Figma, hear our cries for this, it would be really powerful and cut a lot of extra work out of our daily lives aka : High Impact, Low Overhead easy win for Figma Crew!

Thanks ​@Thomas_Nabelek & others for adding to this.


Marcos_Campos

Same problem. This would reduce my prototyping time to half of it. 
Please add this feature.


LouisJR
  • New Member
  • 1 reply
  • January 27, 2025

+1 This is quite a pain to not have this feature


Chas_Barton
  • New Member
  • 2 replies
  • February 20, 2025

100% an intuitive need for us as designers. 

Expectation:
Because the object is visible as I create the property and set the toggle to Off, I would expect Off to = Visible.

Reality:
Instead, I get surprised when I click Create. The object now becomes invisible. Not my intention. In order to accomplish my goal of a component variable where I can essentially click a toggle On to get a simplified version of the component, I have to use a normal dropdown variant selection instead of a simple boolean.

@Figma, here’s my workflow where I expect it to work:

  1. Select currently visible object within component. 
  2. Click Apply Variable Property +New
  3. Name variable (i.e. Hide Text) and set the toggle value to Off

Eric Gmutza
  • New Member
  • 1 reply
  • March 7, 2025

Crazy that we still don’t have this feature.


Yuanrui_Li
  • New Participant
  • 6 replies
  • May 12, 2025

Need the same feature from a year ago, but it’s still missing -_-


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