Skip to main content

Auto Layout with Relative Size Options for columns (eg: 30%)


JohannesUXBerlin

Auto layout is great but the ‘fill container’ options spreads the items equally. It would be great to specify that an element should take up two thirds of the parent. This would be possible by adding a property similar to flexbox. I created this codepen to show how this allows nice grids:

By default this property would be ‘1’ for items. If the user has an auto layout frame with two items this property can be set to ‘2’ so the item would take two thirds of the container.

This could be added to the menu where the stacking order and basement align is changed to avoid adding complexity for users who don’t need this feature.

This topic has been closed for replies.

9 replies

Gleb
  • Power Member
  • 4708 replies
  • May 15, 2022

You can use regular stretch layout grids with constraints for this, no need for auto layout.

video source


Klesus
  • 237 replies
  • May 15, 2022

If your layout is easily divisible in fractions like that then that’s a good solution, but if for some reason it needs to be exact, like say 31% for arguments sake, then it really would be nicer to just set a percentage number as the width.

The only and easiest way to do that that I know of is to split the sections up in frames, as wide in pixels as they are supposed to be in percent. I.e. 31% = 31px.
Set the constraints on these frames to scale and then wrap them inside a 100% (100px) frame. Then scale this frame to the supposed size and the inner frames should keep their proportion still.


JohannesUXBerlin

I am aware of the grid but it does not do the hugging of child elements. The height cannot be changed in the component area instances. The auto layout is also overridable in instances so you could create variants with different layouts.


JohannesUXBerlin

If you‘d want 31% you could just give 31 to the first element and 69 to the other.


Klesus
  • 237 replies
  • May 15, 2022

That’s exactly what I said.


Gus2
  • 9 replies
  • May 16, 2022

This could be related to the grid column you set on your document.
You could choose “auto layout” or “flexbox grid”. Once you select the element and the flexbox grid is activated, instead of fill container, or hug, you have the number of columns you want…

This would be AWESOME


Dylan1
  • 10 replies
  • July 18, 2022

+1 for this, we have a lot of components that have mixed column widths. Even with the “stretch” property set, often the items don’t truly remain aligned to the layout grid itself, they stretch based on percentage.


Dennis_N
  • Power Member
  • 188 replies
  • August 5, 2022

This feature already has >100 votes:

Let’s push it further 💪


  • 0 replies
  • November 3, 2022

This topic was automatically closed 90 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