Figma Support Forum

How to enable Bidirectional Hugging?

Hey friends!

I was really floored by the “Pushing Figma to its limits” talk at Config – so floored, in fact, that I managed to forget how @Mr.Biscuit managed to get bidirectional hugging working near the end.

By bidirectional hugging, I mean that he’s got a parent container set to “hug contents” and the children set to “fill container” – no fixed width frames involved, and the dimensions are set by second-level children.

image

Try as I might, I can’t get this working…

Thank you for asking this question because I just discovered it now works by default without hacks! Simply set the outer frame to Hug Contents and the inner one to Fill Container. And it works! Here is the demo:

1 Like

Oh wow. I feel foolish! Thanks for pointing this out.

I think the reason I couldn’t reproduce it was that I wasn’t using text as the innermost frame.

I’m guessing the hack Mr. Biscuit shared would have worked with anything but text, huh?

How so? He showed it working exactly as I showed in my example. The problem was you needed some trickery to make it work but now it works by simply hugging a fill container frame.

I wasn’t using text as the innermost frame

You can use whatever you want, even rectangles.
image

LOL dude. I swear I just tried to do it with rectangles before I posted.

Either I’m way too tired or I’m being trolled! :woozy_face:

Thanks for putting up with me, haha. Good to know this works as expected now.

Also @Mordechai_Hammer, We’ve got some amazing example usages coming up! :confetti_ball: