Figma Support Forum

Have background fill container separate from label

I don’t think this is possible but wanted to throw it out there just in case. I’m trying to create a dropdown menu that will resize horizontally depending on the length of the labels. The problem I’ve come to realize is that I can’t set the ‘Menu option’ to fill container at the ‘Main component’ level since it has to be inside another container. Since I have different states for the different ‘Menu option’ components the background for the ‘Hover’ or ‘Selected’ state for instance won’t fill the container without setting that instance to ‘Fill container’. The issue is that this is for a design system so we don’t want everyone who uses this component to have to manually set that if they do change the length of the label for one of the ‘Menu option’ components.

Is there any way around this?

Thanks!

@B3n I’m trying to understand what the desired outcome is - Do you want the behaviour of the ‘Menu option’ text, on the hover or other states, to have the background fill the entire container?

Meaning, in the image above, ‘Test’ - you want it to have the background as the same width as the ‘lorem ipsum…’ variation? Do you have a test file to share?