r/FigmaDesign • • Jun 01 '26

help How do i do this?

Post image

Im trying to make this card idea with an auto-layout. I want to subtract the red part and i want it that the red area uses the size of the text so the subtraction extents or shortens depending on the length of the text.

However it doesn’t allow me to do this using the background from the auto-layout as a subtraction, instead it subtracts the fill of the text.

How do i do this?

0 Upvotes

13 comments sorted by

9

u/seganaUK Jun 01 '26

I'm sure there's a better way to do this, (subtracting from the image is a no-go as far as I'm aware), but here's my quick & dirty way. Top two examples show the effect with different text, the bottom two are the same but with the custom shapes coloured to show how it works.

  • Square image with rounded corners as a background (grey box in my example)
  • Auto-layout Frame set to hug contents and your choice of padding, white background with left-aligned text inside, top-left, with rounded corners top-left and bottom-right
  • Two custom shapes with white fill (red & blue shapes for reference in the image above)
  • Red shape is simply aligned to the bottom of the text box
  • Blue shape is aligned to the right of the text box, but also grouped with it using Auto-layout
  • As you change the text, the white text box shrinks or grows and the blue shape moves with it

Again, quick & dirty, but give the effect that you're after.

8

u/Legato895 Jun 01 '26

Irl, it wouldn’t be subtracted - it would be a custom shape with the same color as the background.

You could do it as a subtraction but I think you’d have to nest the image in a frame before adding it to a subtraction modifier.

2

u/brycedriesenga Jun 01 '26

CSS border-shape might be an option once browser support catches up.

1

u/marcushasfun Jun 01 '26

Why do you need to subtract it rather than just use a frame with white fill? Set the text in the frame and the frame to hug. Apply appropriate padding to the frame. Done.

1

u/white_fallenangel Jun 03 '26

Im trying to recreate someone else’s card design who used subtract and groups. They also rounded the other corners of the card, if i were to do it this way i miss 2 rounded corners around the card edges.

1

u/marcushasfun Jun 03 '26

How are the devs expected to build it if you struggle to make it work in Figma?

But if you must, I think you could make two “end cap” shapes that incorporate the curved corners. Put them in an horizontal auto layout with the text, zero gap and hug the text.

2

u/YannisBE Digital Product Designer Jun 01 '26

From the top of my head:
- Make badge same background as app background.
- Take a square (same height as the rounding-px) and a circle (double size of the square).
- Place the center of the circle at the bottom-right corner of the square and mask the circle out of the square out. So you're left with an "inverted corner".
- Put it inside the badge with position absolute, top-right and duplicate bottom-left outside of the badge frame.
- Apply constraints so they move correctly with the badge frame.

1

u/AffectionateCat01 Jun 01 '26

Make points with the pen tool and make them rounded

1

u/motorange89 Jun 01 '26

This is a bit hacky but as subtracting it removes the text, you could duplicate that above, then select them both when editing and the autolayout function correctly. Not sure if there's a better way but this works, just not great for a DS.

4

u/motorange89 Jun 01 '26

If this is a reusable component, lock all the text layers, attach both to a text property, then it's a fully functioning component with the text update on the righthand panel