Figma Support Forum

Accordion Menu resizes width to fit label

I’m trying to create an accordion style menu and I want the width to resize according to the length of the labels and I just cannot for the life of me get that part to work. So the goal is that if any of the accordion menu item labels exceed the default width of the Accordion it will resize to accommodate the longer labels.

Any ideas?

Hi B3n! I think you want to use “fill container” on the autolayout.

Screen Shot 2021-09-25 at 11.49.42

Yep I’ve tried every combination I I can think of using Auto Layout and I think the problem lies with the ‘Accordion-State’ component. When I change the ‘Resizing’ on the ‘Accordion-State’ components that are nested inside the main ‘Accordion’ component it changes the width for the ‘Accordion’ to be ‘Fixed’. Then if I change the resizing to ‘Hug Contents’ for the ‘Accordion’ component it will just change the ‘Accordion-State’ components to ‘Fixed’ and it just keeps going back and forth like that.

I guess there’s no way to have this kind of component ‘Fill Container’?

This topic was automatically closed after 30 days. New replies are no longer allowed.