Skip to main content
Solved

How to enable Bidirectional Hugging?


Mordechai_Hammer

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…

Best answer by Gleb

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:

View original

Gleb
  • Power Member
  • April 28, 2021

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:


Mordechai_Hammer

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?


Gleb
  • Power Member
  • April 28, 2021

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


Mordechai_Hammer

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! 🥴

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


Mr.Biscuit

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


Reply


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