Skip to main content

Hi all,


I’m stuck with a problem you can hopefully help me with. I have a component that has several booleans of turning things off and on (see image).


However, the component doesn’t shrink when I turn of both bottom items (text description and attachment. It does shrink when I only remove the description to the height including the attachment icon. I did try several settings and hug on the outer container doesn’t solve the problem. Any ideas?



Is it possible that the boolean for show Description is linked to the Text Layer and it’s inside another layer? Figma treats text layer visibility a little different, and even if the layer above it is set to Hug vertically, it will keep the same size…


Description (←Layer)

↳ T] Description lorem ipsum (←Text Layer)


If you link the “Show Description” Boolean to the Layer, not the Text Layer, it should work like you’re expecting.


Hey Bauke,


Thanks for thinking with me. Both description and attachment icon are in a layer that autolayout’s them horizontally. But we want to be able to turn the visibility off separately or together. We now set a boolean on the ‘mother layer’ that contains both components as well, but it feels a bit hacky altogether.


I managed to replicate it!


It’s a weird Figma bug for sure. I thought it had to do with Figma having trouble with the text layer visibility, but it’s actually the layer above it (The one that contains a text layer) that messes up.


It looks like a layer containing a hidden text layer AND another invisible layer (In your case the attachment icon) with both the text layer and the icon set to invisible will retain the height of the text layer



EDIT: It doesn’t need to be a hidden text layer, it also happens when a layer is empty or contains only hidden objects. For some reason it won’t set its height to 0. But if you nest it in one more layer and hide THAT layer, it works…



Now…

In your case: Would you ever show the Attachment icon without the Description?


Your screenshot shows a truncated headline, so I was assuming you’d never really have a situation where the attachment icon shows without a description.


If so, it makes sense for the whole Layer that contains both the text and the icon to be hidden. And, as a bonus, your instance would only show the boolean switch for the attachment icon when you turn on the description layer. (Good for when other designers use your component 🙂 )


If they need to show independently the solution is to use variants:



  • One with the text and the Icon

  • One with only the icon


If you name the variants “Show Text: False” and “Show Text: True” it will behave in the exact same way, showing a switch.


Assign the boolean to the icon like you did before.


It’s not very elegant… But it behaves like you think it should.


Hey Bauke,


We do want to show the attachment without the description, so yes, we are setting an extra boolean on the combined layer. I was thinking of dropping the ‘container’ for the text and attachment icon, and set the icon to absolute position, but I’m not sure if we want it to move to the left when there’s no description.


Either way, thanks for testing with me, I highly appreciate it!


If you use the 2 variants solution, you can put the icon wherever you want. 🙂



Will give you these options:









Reply