Skip to main content
Question

Dynamically set width of component instance based on another instance

  • January 5, 2023
  • 3 replies
  • 2367 views

bryan_hopple

I would like to be able to dynamically set the width of multiple component instances based on the width of a base (or reference) instance.

Example: given multiple horizontal content tabs with text labels of varying lengths, I’d like have all tabs match the width of the longest label, but solely dependent upon the label length, not relevant to the container or depending upon auto-layout.

This topic has been closed for replies.

3 replies

Saulo_Vallory

I think you can achieve that by creating a “stretcher” component and placing it inside the component for the instances you want to stretch and the reference variance.

If that doesn’t make sense to you, please share an example file showing the structure of the component you are working on and I’ll take a look


bryan_hopple
  • Author
  • New Member
  • 3 replies
  • January 6, 2023

Hey Saulo! Thanks for the quick reply. I have managed to achieve your suggestion, I think. but I also need to make the resulting fig frame into a component, such that a user could pull this overarching component from the library and specify which tab element (instance) should be the base and have the other tab instances match that base width.

I don’t think this is currently possible, because as soon as I convert the frame into a component, the base/reference tab master component is converted to an instance and the master component is ejected from the main component. Apparently I cannot attach a .fig file here. Cannot post a link as corporate guidelines prohibit that.

Any super-secret tricks to maintain an embedded master component?

Thanks,
~bryan


  • 0 replies
  • February 5, 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