Figma Support Forum

Variant with auto-layout: how to put a layer with opacity on?

I have a problem with components using auto layout.
I have an element and i want to put a blue layer with opacity when it is selected.
To do that i have to remove auto layout settings but when i use the component it does not fill the container because of that.

Is there a way to put a layer upon the component, using auto layout?

This is my component

This is the side effect
image

Hi, I’d have to see the layers and resizing properties panel to be sure but it looks like the constraints on your blue overlay aren’t properly set. Be sure to set the horizontal resizing to “Left and right” (and also vertical to “top and bottom” if you expect overrides to make your component grow).

That being said, a cleaner solution would be to change your component background color, except if you also need the overlay on elements (text, icons, etc.)

Hi Antoine,
thanks for your reply, unfortunately change the background is not an option because i need the blue overlay over every element (text and icons).

Your tip about “left and right” constraint was useful, after a little bit of struggle (maybe more than a little bit), i reached my goal.