Figma Support Forum

How do I use a component as a background within Auto layout?

I have a number of components that use the same dropdown background, that I’d like to use as a nested component.

The problem is, I can not get the background component to resize based on the number of items in the menu.

For example, if I have 10 menu items, I want the background to resize based on the number of menu items visible. Autocomplete either treats the background as another object, putting it below all the menu items, or if I put it in a different group, it does not resize it.

The only way I have found to do this is to not use a nested background component, but rather a style. Which unfortunately only applies the drop shadow, not the border radius, border, or background. I know this background is going to change soon, so I’d rather built it with a nested component that I can change once than have to go into several dozen components in the future to change them all individually.

Any suggestions?

1 Like

Can you share a demo file?