Skip to main content
Solved

Flexible Auto layout component (accordion)


Benjamin_Bruaroy

Hello people!

I want to create a component, to which I can freely add varied content. For example, an accordion, without having to define all content variants in advance. Is it possible? I want to be able to use components inside this component and have it auto-scale.

Let me try to explain in more details:

I have an accordion component, which has different states. Open/Closed etc…

The variants uses auto-layout, and the width and height is set to “hug” contents.

When using my component, I can not paste anything new inside. I have to detach it:

What I would like, is to replace that grey rectangle with anything else. Sometimes another component, sometimes it may be just text.

Is it a way to make my component flexible in this way? Is it strictly not allowing me to put other stuff inside my component on purpose?

Is it a workaround for this, or is it “bad practice”?

I would find it very useful.

Best answer by tank666

Watch the following videos about the “slot” method.

View original
This topic has been closed for replies.

3 replies

tank666
  • 4873 replies
  • Answer
  • April 11, 2023

Benjamin_Bruaroy

Thank you very much! This was exactly what I was looking for 😀


  • 0 replies
  • May 12, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings