Skip to main content

Fill width and height when ignoring auto layout

  • March 16, 2025
  • 1 reply
  • 74 views

Ashley
  • New Participant
  • 4 replies

I want to set up a background for a component so that I can toggle different background fills and borders. This would let me set up different states like “enabled”, “disabled”, “selected”, etc.

For a rectangle to be in the background I have to set it to ignore auto layout. But as soon as I do that I can’t have it resize to fill its container.

I want to set absolute position to 0,0, but “fill” width and height so it covers the entire background and the border matches.

Another way to do this would be to show/hide fills and borders based on a property, but having a background would let me create a nested component so I can define all my states in one component, then use it as a background across my library.

1 reply

Nellya
  • Power Member
  • 568 replies
  • March 16, 2025

You need to set constraints for your absolute positioned ractangle Left + Right and Top + Bottom

 


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