Skip to main content
Mark_McIntyre
New Participant
April 17, 2024

Allow percentages for line height

  • April 17, 2024
  • 197 replies
  • 25150 views

Firstly great job Figma Font variables are here!!!

The only thing missing is the use of percentages in the line-height property.

You can not use a percentage in the line-height as it only accepts variables that are a number type.

Although the variables for line-height caters for pixel (absolute) line-heights (10,12,14)- it does not accommodate relative line heights.

In other words you can’t use percentage variables for line heights that are a percentage of the font size (100%, 120%,150%).

Interestingly …You can use a variable for letter-spacing ( which accepts a number variable - but reads it as a percentage) - the challenge remains that line heights by default are absolute not percentages - even though you can input a percentage.

Percentages allow greater flexibility and less calculations

Word around would be to allow formula in a variable
e.g. =[variable] * 1.5

Or figuring out a way for the line height to be toggle between absolute or relative application of the number variable.

197 replies

Neil_Johnson
New Participant
May 17, 2024

This is needed. I don’t know how it released without this function. Now I have to convert to px based and when the inevitable release happens later this year I’ll have to convert them all back to % again.

neelts
May 20, 2024

+1 for that too, @Mark_McIntyre for the formula part you can try my new plugin for now, I made a video to show your request in action:

You can see that the variables h1-line-height, h2-line-height & h3-line-height use formulas, just like you mentioned:
{{ Math.round( $h1-size * $line-height ) }}.
So their values are automatically updated when you change the line-height or h1/h2/h3-size variables.

And of course the link to the plugin:

Figma

Hope this helps!

Denis_Obuhov
New Member
May 23, 2024

Must have feature!
Waiting for it so much!

Moon_Rat
New Participant
May 28, 2024

I know we can work around this issue by using formulas to calculate our line-height from a percentage variable and the font size in px. But this is adding so much complexity that I’d rather not use it at all for now.
Would love to get this in a new iteration of typographic variables!

May 29, 2024
  • 1, needed. It waste so much time to set each line height manual 🙂 And the percentages are the best way in this case
May 29, 2024

+1, needed. It waste too much time to set each line height manual 🙂 And the percentages are the best way in this case

Jaszkin-Man_Jakub
New Participant
May 31, 2024

Out team also needs this! 🫵

Samantha_Lawrence
May 31, 2024

What I have never really understood about the implementation of type variables, is that the variables are set in all the sub-fields of the old type styles. What I expected was, similar to color tokens, the old type styles go away. I should have H1 as a variable, with all the settings hard-coded in it. Then I use modes in the variables palette to create necessary switches. Being able to hide type styles would be so helpful in larger systems that have component-specific type styles. I don’t need those showing up for all designers.

KennLucas
June 5, 2024

I found this not correct for letter spacing.

Yes, you can use a variable. But no, it does not read as a percentage.

Setting a variable “10” in the letter spacing field is a much greater spread than 10 “PERCENT.”

The letter spacing field also should allow setting of a percent value as needed for line height.

Potentially, this would be an easy fix for Figma if they just allowed a string there.

KennLucas
June 5, 2024

Absolutely! I have been chasing this windmill for a bit.

I just don’t understand the value of variables when they still have to be put into manual styles anyway.

And definitely agree with the need to keep designers working and not thinking about these things.