Conditional auto-layout margin

I have a text line that has a max-width of 800px. the text line also has a fill in color with white that has top margin 16px and bottom margin 16px. So that it looks like a chat bubble.

Any text that falls under 800px will be considered as a single line but anything more than that will be considered as multiple lines.

I want my text line to have 24px margin on top and bottom both when the text goes more than 800px (when it becomes multiple line).

is there a way to achieve this on Figma?

1 Like

Hi there,

Thanks for the post! I’m checking with internal team to see if it’s achievable. I will update if there is anything I can share with you.

Toku

Hi there,

Have you managed to resolve this issue? I received some insights from a colleague, though I can’t guarantee they will completely solve the problem. Let me share what I know. Probably, you could use a boolean toggle to add or remove extra spacing based on the size of the element. Essentially, you would have several predetermined sizes for the component, one smaller and one larger than 800px. The toggle would then use a set of variables to determine 1) the width of the component and 2) whether the boolean is true or false. This approach might be worth trying out.

If you can’t solve this, you can reach out to our support team: https://help.figma.com/hc/en-us/requests/new. They can give you further assistance.

Thanks!
Toku