Skip to main content
Jul 11, 2023 11:02 AM UTC

Invert boolean variable for layer display

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
Jul 11, 2023 12:16 PM UTC

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
Jul 11, 2023 2:28 PM UTC

@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
Jul 29, 2023 2:07 AM UTC

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
Aug 14, 2023 8:48 AM UTC

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
Sep 5, 2023 5:36 PM UTC

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

p.o-donovan
New Participant
Sep 5, 2023 6:07 PM UTC

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
Sep 14, 2023 8:29 PM UTC

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
Sep 26, 2023 4:21 PM UTC

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
Oct 9, 2023 9:59 PM UTC

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
Oct 19, 2023 4:27 PM UTC

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