My master component works perfectly, but the instances do not

I am new to Figma (switching from Sketch) and think I’ve understood how auto-layout and constraints work. My master component works perfectly, but there seems to be an issue is with the “hug contents” parameter in the instances. When I swap a list item (heights 40px) for a line (height 1px) the parent frame resizes as expected, but the instance does not. I have wasted hours now trying to solve this. Am hoping someone can put me out of my misery!

Hi @Claire_Bickerton!

Pretty sure we can fix this. But it’s really hard in this format. Could you share that part in another file so we can take a closer look?

Thanks for getting back to me. How can I share the file as I can’t seem to paste a link in this reply box…

Hey @Claire_Bickerton,

You should be able to add a space or two in between your file link. Then, we’ll be able to parse it back together to view the file. Here’s an example:
https:// www.figma .com/file/AywnckA4L2FCoa0LK7EZ1

1 Like

Gotcha - thanks! And thanks for any guidance you can provide in fixing the issue I have :blush:

https:// www.figma .com/file/janotKMHbMPUof62EAnqVx/Instances-issue

The issue is that that the component variants aren’t autolayout components, so they are inflexible with their sizing. If you change them to be autolayout then fill/hug overrides will be obeyed.

@klesus — I thought the same thing. But after testing it it seems like that is not the case.

@Claire_Bickerton I have tried many solutions — the straight forward one seems to be rather simple. No need to change eveyrhing to auto layout — even if I would advise you do it anyway.

Adding rectangle element inside that Empty + fixed height + Auto Layout variant you called “Line”. Then setting fixed height on that element. And on top level Auto Layout set resizing to hug contents.

For some reason this seems to work. Looks like empty auto layout has some specific behaviour regarding fixed size instances… Not sure what’s causing it. But hope this fix helps.

1 Like

Thank you very much for looking into this issue Marko. Your solution has solved the problem! I am very grateful.

1 Like

Thanks Klesus for looking into this issue. I tried to change my components to AL, but I ran into a number of problems with the positioning. Thanks for your suggestion though.

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