Skip to main content
Solved

Components with auto-layout


Kalmer_Rautam

Is it possible to make components with auto layou. E.g. I’m making form container with auto-layout enabled and wherever I’m using it, I can drop different components (fields and buttons) inside it.

Best answer by javieralaves

There’s a sort of hacky way to go about this. You can create a main component called Placeholder, and then another main component (let’s call it Container) with Auto Layout that wraps multiple Placeholders.

This way, any time you create an instance of Container, you can replace the nested Placeholders that you want to have visible for that instance, with any other component you want from within the tools in the Inspector.

Does that make sense?

View original
This topic has been closed for comments

6 replies

tank666
  • 4868 replies
  • March 9, 2021

You can add any objects only to the master component. It is not possible to add or remove objects to instances of this component.


javieralaves

There’s a sort of hacky way to go about this. You can create a main component called Placeholder, and then another main component (let’s call it Container) with Auto Layout that wraps multiple Placeholders.

This way, any time you create an instance of Container, you can replace the nested Placeholders that you want to have visible for that instance, with any other component you want from within the tools in the Inspector.

Does that make sense?


John_Hatton_SIL

@javieralaves

When you say “replace”, do you mean delete the placeholder and add something in its place? And if so, how does that help?

Asking because I can’t seem to find a “replace” command.


javieralaves

Luis from Figma recently recorded a video on YouTube that explains this method. I hope it helps!


Kalmer_Rautam

Thanks @javieralaves ! Yea, I noticed that video on YT lately. And I fully agree with that hacky part. Hopefully one day Figma will solve it in more elegant way 🙂


Tim25
  • 4 replies
  • March 9, 2022

+1 here; auto layout and components are both awesome individually, but they only fully make sense if they work together. Not being able, for example, to drop another item into an instance of a list is a real blocker to realising their full combined potential.


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