Skip to main content
Question

Auto change component height when inside elements are changed in height

  • February 9, 2024
  • 4 replies
  • 2362 views

Hi, how can I make sure my component (for example footer) is changed in height (the actual purple border of the component) to the height of my elements in that component?

Check my example file: https://www.figma.com/file/afDCWUx0OxrvRWBRVAtYe8/Untitled?type=design&node-id=0%3A1&mode=design&t=KN4sqINUcVEId34W-1

I come from Adobe XD and am struggling with some habits I had over there.

Thnx!

This topic has been closed for replies.

4 replies

Haroll
  • Active Member
  • 273 replies
  • February 9, 2024

Hey @Dylan21

You should take a look at Auto layout : this is a smart container that can adapt in both width and height according to what’s inside it

Hope it helped


  • Author
  • 3 replies
  • February 9, 2024

Hey @Haroll, thnx, I already use that for other things, buttons etc, but will look into that for footers as well. One more thing: when I want to increase the height of the frame ‘Test components’ everything in the frame changes position as well, I just want the bottom part to extend with the elements staying in place. How to achieve that?


Haroll
  • Active Member
  • 273 replies
  • February 9, 2024

Ok so when you’re putting a element in a frame, this element get a Constraint section in Design Panel
image
This section allows you to manage how this element will behave if the frame change in size


In your file, the Test components frame contain a text block : Dragged the rectangle higher to the top and this one has constraints set to Scale (both in X and Y) which means whenever you resize the frame Test components the text block will scale up/down according to parent frame. In order to have every item keep their size and place but the last one :

  1. Turn Test components to an auto layout (while doing so you may have to replace items to their original position, and check the layout so it’s horizontal)
    image

  2. Set its height to hug, so every item will fit inside

  3. Set the bottom part height to Fill, so it will expand to take all remaining space


  • Author
  • 3 replies
  • February 9, 2024

Thanks. But if I auto-layout my artboard then the footer will not automatically stick to the bottom anymore if I increase the height of the artboard. With all the different align settings:

image

Or is this another setting I’m missing?

Also, with all things stacked with auto-layout I cannot give the header a fixed position anymore.


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