Wondering if it’s possible to “stack” multiple elements in an Auto Layout frame. See attached images for reference. I’m trying to add a stroke behind the text that will get wider/narrower depending on text length.
I tried adding negative padding, but that’s not supported. I’m new to Figma so hoping there’s a simple workaround that I just haven’t discovered yet.
Hello, you can’t add negative values in Auto Layout yet. It’s one of the most requested evolutions, see here and vote!
In the meantime, if the height of your Frame is constant (only one line of text), there’s a workaround:
Select your stroke, click Frame Selection. Set the containing Frame to stay on top of your Auto Layout Frame
Set the Resizing constraint to “Fill Container”, with the desired padding
Inside the containing Frame, set the constraints of your Stroke to “Left and right”
Now change the Y value of your Stroke to place it behind your text, it will stay there and expand with additionnal text. However it won’t move if the text grows or work with multiple lines.
Thanks Antoine! I guess I can’t have it so the line extends past the text on both sides?
Either way, this hack is super helpful and gives me something I can build on.
Awesome. I wasn’t quite following that second step, but I played around a bit and still got what I wanted. Here’s how: I wanted the stroke to extend 4 px on each side, so I made it 8px wider than the container, then set the X value to -4 and it worked like a charm.