How to make space for an accordion component dynamic

I’m creating a “smart accordion” using auto layout and components to create expandable cards in the middle of a webpage. Below the space for the accordion will be additional text on the page that doesn’t belong to this component.

Is there a way make it so that the space the accordion takes up adjusts dynamically based on the size of the accordion as it expands and contracts so that the rest of the text below the accordion will adjust to hug the bottom of the accordion? Otherwise, the text remains fixed so there is either a giant gap or the text gets covered by the expanded accordion.

You can auto layout the two different sections. Basically like what you’re doing for the accordion.

It might be a bit of a hassle because you’d have to auto layout everything below it.

Hope that helps.