How would one create a collapsable FAQ module?

I would love to create a collapsable FAQ accordeon.

What I’ve tried
I’ve created 2 variants (open and closed question). Then I combined an instance of that interactive component into another component with smart layout, combining multiple instances into a list.

The result + problem
It folds open successfully but the second / other questions / rest of the page sections don’t move down to make space for it.

Bonus question
As a bonus question I’d like to make it so that only 1 question is in the open state at the same time.

1 Like

I think you may be able to achieve this with Auto Layout if you can add Auto-Layout to two variants

But the problem is, you can’t do that as of now.

You need to create as many options as there are question items. Where one item is open and all the others are closed.

@tank666 I’m looking to do just that: make a component with a collapsed and an expanded state that pushes or pulls other elements up or down. Is this currently possible in the beta?

Hi @Thom_van_der_Doef, currently, when playing a prototype (Presentation mode) it doesn’t work properly yet.

You can do it by applying auto layout and set height to hug content

@tank666 Just like Thom_van_der_Doef, I’m currently trying to make a component with a collapsed and an expanded state that pushes or pulls other elements up or down, with smart animate and autolayout. It does seems to work when I have one element alone, but as soon I’m trying to use many of them with autolayout, only the last one has the desired behaviour. It seems that for all the others, when the expanded content appears, instead of pushing others elements below, it just appears behind it. Is the expected behaviour currently possible in Figma ? Or I have done something wrong ?

Hi @Gwen_PETITEAU, it’s hard to say something without seeing how your file works. When Interactive Components came out of beta, they began to support Auto Layout. I made an example for you, which you can see here:

1 Like

Hi @tank666, thanks for the prototype, it’s exactly what I’m looking for ! Is it possible to have access to the file with the layers and prototype interactions to see how it works ? It seems that I can access the prototype only.
Thanks for your help !

Click on the chevron next to the file name and select “Open in editor”. You can then duplicate the file to be editable.

1 Like

One small thing that solved this for me was to uncheck the “clip content” box when using autolayout. Banged my head against the wall for a good hour before figuring that out.