Skip to main content

Combine string variables in text layers


Matteo_Gratton

I was trying to find a way to combine more than one string variable together without the need to create to text layers.

My use case is:

  • I have plenty of small string variables with specific details associated with a main variable mode.
  • I have plenty of variables modes.
  • I need to combine some of the variables together to generate a more complex string.

Current possible solutions (both the solutions are not great for various reasons):

  1. Create 2 text layers and connect them with String Variable A and String Variable B.
    [I need to create an auto-layout frame that contains the 2 layers and resize automatically based on text content and if a variable is empty for any reason]
  2. Create a String Variable C that contains String Variable A and String Variable B.
    [I need to copy and paste the content of both Variables A and B into Variable C. If anything change in time for A or B, I have to change also C]

I’d love to have an option to say: this text layer contains Variable A + Variable B (+ can be also a way to add a space, or a character if needed - like you can do in Prototypes when combine different variables).

What do you think? Am I missing anything and overcomplicating something that already works (I was not able to find it!)? 🙏

11 replies

muh_jad
  • 1 reply
  • October 31, 2023

i definitely need the answer also


dvaliao
Figmate
  • Community Support
  • 4603 replies
  • November 3, 2023

Thanks for the feedback!

We’ll pass this onto our Variables team for consideration.


Ran_Jakubowicz

I definitely need this one also. 🙏
I want to be able to add variables inside text

for example:
Hi {user_name}

would be mega helpful to have a solution for it.


Martin_Mateos_Sanchez

Great idea 👍


gemmy
  • 4 replies
  • March 12, 2024

Yes, I need this too. This would be so timesaving to avoid creating slightly different string variables. And please also consider how we can support localisation plural form in one go. Thank you Figma 🙏


Also need this as want to put a product name that could change over time across the life of the product - so want to put text either side of a text string variable and can’t work out how to get the auto layout frame to get the text to wrap (breaks it into three parts - text - variable - text)


Marek_Rutkowski

I also need to combine multiple fields in one text to wrap things


Marek_Rutkowski

i need to have a multiple variables or text


neelts
  • 10 replies
  • May 25, 2024

Hi @Matteo_Gratton & @Ran_Jakubowicz, you can achieve this by using my plugin, I made a video with a similar examples on working with strings:

In short, plugin uses code expressions right in the local variables window, so when you refer to other variables they will be updated automatically, so no need to manually update the same thing (you can copy formulas from the video description).

Hope this helps!

Oh, and link to the plugin:
https://www.figma.com/community/plugin/1365339609215368041/dynamic-variables


Steven_Twigg

Would really like this feature. It’d help greatly. The workarounds for this cause really big issues in dev handoff.


Matt_Rooney
  • New Member
  • 1 reply
  • March 11, 2025

+1 to this one. Two cases specifically:

  1. Inline a variable into the middle of a static string
  2. Expand variable-to-variable referencing to let us build strings like:
    1. $sentence = Welcome to $productname, $username 

       

Our content design folks here at $VeryBigCompany would really like to give us a library of standard terms to align to internal standards, but since we can’t insert variables mid-string or build variables by concatenating other variables, we can’t support that ask.


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