Skip to main content
Solved

Auto size with a complex background

  • December 24, 2021
  • 7 replies
  • 1983 views

Tara_Price

I’m trying to do something rather complex and about 90% sure it isn’t possible with the current autolayout options.

I have this modal design. The background is a rather unique shape. I want the background to adjust when the internal container (dashed for demo) changes in size. I’ve set that as a slot that I can replace with different content.

The interior section will need to be adjustable, but the spacing is 48,8,8,8. The modal


Screen Shot 2021-12-23 at 4.23.43 PM

Best answer by ntfromchicago

Here’s a proof of concept that I think covers your use case:

Figma – 25 Dec 21

The main technique is hacky but I’ve used in production; it’s basically a fixed zero-height background anchored to the top right corner (with clip content turned off). The actual background is a component large enough to accommodate the widest size of your modal. (In theory, you could use an image for this background but it is not performant as an SVG).

Hope this helps!

View original
This topic has been closed for comments

7 replies

tank666
  • 4863 replies
  • December 24, 2021

Hey @Tara_Price, you can’t do without hacks.
I made an example which you can see from the link below.

Design file:

Figma – 24 Dec 21

Tara_Price
  • Author
  • 15 replies
  • December 24, 2021

Kinda but not quite. It looks like when the content grows, the angle of the blue will not adjust.

Right now I’m manually adjusting the size of the background portion. But I was hoping I was just missing something obvious.

Thanks for the attempt! 🙂


tank666
  • 4863 replies
  • December 24, 2021

Could you demonstrate how it should work?


Tara_Price
  • Author
  • 15 replies
  • December 24, 2021

I have the angle blue fill pinned to the top right corner. And the size of the modal is based on the size of the content I’m swapping out.


ntfromchicago
  • New Member
  • 287 replies
  • Answer
  • December 25, 2021

Here’s a proof of concept that I think covers your use case:

Figma – 25 Dec 21

The main technique is hacky but I’ve used in production; it’s basically a fixed zero-height background anchored to the top right corner (with clip content turned off). The actual background is a component large enough to accommodate the widest size of your modal. (In theory, you could use an image for this background but it is not performant as an SVG).

Hope this helps!


Tara_Price
  • Author
  • 15 replies
  • December 29, 2021

Thanks @ntfromchicago for the help. The directions definitely solved my issue. It is hacky, but it’ll work for my master component. I was also able to put my header content in that top frame. So bonus!


  • 0 replies
  • January 28, 2022

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