Skip to main content
Question

Font weight can't be applied to text if number variables are used

  • February 25, 2025
  • 1 reply
  • 16 views

Hi, 

I want to use number variables for font weight so that the variables connection can be displayed in dev mode / inspect panel. However, it seems that the font weight is ignored when applying the text style to text in Figma.

When string variables are used, you get to see the following in dev mode / inspect panel > CSS:
font-weight: 400;

When number variables are used, you get to see the following in dev mode / inspect panel > CSS:
font-weight: var(--Regular, 400);

After creating number variables for font weight and text styles that are connected to the variables: 
It seems that the font weight is ignored when applying the text style to text in Figma. When using string variables it does work. 

Is this a known issue? 

1 reply

  • Figmate
  • 1769 replies
  • February 26, 2025

Hi ​@Feline_Hu, Thanks for getting in touch!


After checking, it appears that the behavior you're observing is expected. When a string variable is used to define a font style's font weight, only the numerical font weights will be displayed in Dev Mode.

 

I did a quick test and saw the same thing:

  1. I made two font styles:
    • One with a number variable "10" for the font weight.
    • One with a string variable "Bold" for the font weight.
  2. I used those styles on some text and then checked the Typography section in Dev Mode. I saw:
    • font-weight: var(--New-group-N_Font-weight, 10);
    • font-weight: 700;

Just a quick reminder:

  • You can use number variables for font weight, but they have to be numbers (like 400 or 700).
  • You can use string variables too, but they have to be font weight names (like regular, bold, or black italic).

You can find more info in this guide: Overview of variables, collections, and modes

 

Hope that clears things up! Thanks again for contacting us.


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