Skip to main content
July 11, 2023

Invert boolean variable for layer display

  • July 11, 2023
  • 45 replies
  • 9501 views

Right now, tying layer visibility to a variable means if the boolean is false = layer is hidden. It’d be great if we could invert this functionality (boolean is false = layer is shown) on a per-layer basis as I need to show some layers and hide others depending on the state of the variable.

Anyone else run into this?

45 replies

gilgongo
July 11, 2023

Yes, I’ve just encountered this too. I wanted to have a button that would show a message on click and hide a panel at the same time. I ended up instead showing a layer over the panel I wanted to hide. So basically, showing some things that hide other things. A bit klunky.

As an aside, I do find it a bit awkward having everything in variables. Things get quite abstract quite fast. So “On click, set Boolean [name] to true” and then have to keep track of what things use that Boolean. Would be nice if you had the option to have common operations like hide/show explicit if you wanted. So eg “On click, show [objectA], hide [objectB]”. Or “On mouse in, set [objectC] to [StateX]” But hey.

tank666
July 11, 2023

@Alex_Cowley,

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
Daniel_Bowen
July 29, 2023

This feature is sorely missing - its UI could be as simple as an inversion checkbox in the boolean property editor.

The above workaround does not remove elements from a frame’s auto-layout flow the way hiding does. Inverted booleans would enable much more meaningful structural variation in components.

Alexey
New Participant
August 14, 2023

Could be really useful. Right now I just create two booleans for such cases. Which results in more work during interactions setup
image

p.o-donovan
New Participant
September 5, 2023

As Daniel said above, an inversion checkbox in the boolean property editor. Please!

p.o-donovan
New Participant
September 5, 2023

it works for self-rolled basic shapes and things but when I try with more complex components, unfortunately they just vanish, but for shapes and things it’s good to know, I don’t see any other solutions out there. Thanks.

Brett_Epps
September 14, 2023

It would also be useful if you could bind the layer show/hide state to an expression. Then you could set it to “not $YOUR_VARIABLE”.

Max_Muller
September 26, 2023

The feature to invert boolean variables would be real nice. Also currently working around by having two boolean variables for each visibility usecase and just taking care where and when to use what of these. Gets confusing after a while, but works, tho.

andreaszzz
October 9, 2023

I’ve had to do this too. Feels redundant, and adds more complexity to the prototype.

We need the ability to hide a layer when a boolean is set to true.

Hudson_Pridham
October 19, 2023

Also looking for this option. It would save me from making lots of redundant boolean properties or variants in my design system file.