Skip to main content
Question

How do I make this component responsive in auto layout?


Alyssa_Ziobro

Hi! I’m trying to make this text styling where the background (vector rectangle whose color can be adjusted). The frame hugs the text and the rectangle fills the container, but I don’t know how to make them overlap without either or being disabled. Here’s what I am trying to achieve versus what I have:

5 replies

Gayani_S
Figmate
  • Community Support
  • 1944 replies
  • January 16, 2024

Hey Alyssa, this Figma tutorial will help you out! Please let me know if you’ve further questions.


Michael_Staton

@Gayani_S where is the link to the tutorial? I’m also having trouble duct taping designs onto my components. In particular, there are backgrounds and decorators that need to be part of a component, yet not invade it. Kin of like the Z-Index in CSS.


Gayani_S
Figmate
  • Community Support
  • 1944 replies
  • January 30, 2024

Hey @Michael_Staton! Apologies, this is the Figma tutorial I forgot to link: https://www.youtube.com/watch?v=PNJxeD29ZTg&list=PLXDU_eVOJTx55HFubfbTL3ellJjBM2QE2.

At a second glance, I think working with Absolute position might be a good solution. As you said you’ve mentioned that you’re having trouble duct taping designs onto your components.

“Absolute position excludes an object from an auto layout flow while keeping it in the auto layout frame. The object and its surrounding siblings ignore each other, even as they resize and move.

absolute-position

Please let me know if this works for you. Alternatively you could share a copy of your file and I can take a look at it.

Thanks,
Gayani


Michael_Staton

Honestly, that doesn’t solve the problem. I know how to do that.

The only solve for this is bewildering, confusing, and infinitely time consuming. Basically, you have to be HYPERVIGILANT as to whether or not your component itself is in a Frame or Autolayout state. If it’s in a Frame state, things resize or don’t resize correctly due to “constraints”. But if it’s in an autolayout state, which most of my components are because nested object states as Autolayout behaves better… But if I want anything to scale as I resize (which is pretty much all the time, right?) I have to go back in and make it a Frame. Once I make it a Frame, things resize or do not resize appropriately, but the Autolayout magic disappears. This forces me to make like 8 different variants of the same component, when all I want is the 1 component I have to behave properly.


Gayani_S
Figmate
  • Community Support
  • 1944 replies
  • January 31, 2024

Apologies that my solution is not helpful! I understand the frustration. I’ve shared your feedback internally to investigate further. If I get a good workaround or any tips from the team, I will update you!


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