Skip to main content

Dynamic text sizes and why we moved away from it

It's possible to use dynamic text sizes without breakpoints

April 26, 2024Designsystemet

The illustration shows that a 16px text size on small screens gradually increases up to 18px on large screens.
The illustration shows that a 16px text size on small screens gradually increases up to 18px on large screens.

With "Fluid typography," we can scale the text size gradually between a minimum and maximum width, instead of having an abrupt scaling at a specific breakpoint. The linear function approaches the desired size evenly across the screen width.

The text sizes increase gradually from a viewport width of 320px until it reaches the maximum width of the viewport, which is set to 1360px. A text of 16px will, for example, increase to 18px on the largest viewport.

The illustration shows that a 16px text size on small screens gradually increases up to 18px on large screens.
The text size automatically adjusts to the width of the screen.

Advantages

  • You don't have to think about breakpoints; the size of the font is automatically adjusted to the screen.
  • When sizes aren't adjusted at specific breakpoints, we avoid piecemeal and sudden upscaling.

Disadvantages

  • Half pixels. Figma rounds down. Some browsers round up, others down. This means things don't look the same in Figma and in the browser.
  • You may feel you have less control.
  • In Figma, this size change can only happen using the "Token Studio" plugin when you have activated the desired viewport for your frame.
  • It's not a given that a product will build its product using dynamic typography. If someone adds modules from Designsystemet to their own interface, it won't match their scaling.

Based on the disadvantages this caused, we chose to go with a static typography scale as the standard for Designsystemet.

Do you need dynamic typography?

If you need to use dynamic typography, please create a feature request, and we can consider the possibility of activating "Fluid" as a separate set.

The sizes used in the dynamic scale were generated using the Fluid Typescale Generator

Stepviewport 320pxviewport 1360px
f-312.00px / 0.75rem12.00px / 0.75rem
f-213.00px / 0.81rem13.00px / 0.81rem
f-115.00px / 0.94rem16.00px / 1.00rem
f016.00px / 1.00rem18.00px / 1.13rem
f118.00px / 1.13rem21.00px / 1.31rem
f219.00px / 1.19rem24.00px / 1.50rem
f321.00px / 1.31rem28.00px / 1.75rem
f423.00px / 1.44rem32.00px / 2.00rem
f526.00px / 1.63rem38.00px / 2.38rem
f629.00px / 1.81rem44.00px / 2.75rem

To see the correct text sizes in Figma, we were dependent on having the Tokens Studio for Figma plugin installed and using it to activate the correct viewport. The video below shows how the plugin was used to get the correct text sizes for different viewports.

Designsystemet logo

Bidragsytere

Marianne RøsvikØyvind ThuneMichael MarszalekTobias BarsnesLasse Febakke Straum

Want to write for the blog?

Do you have something you want to share with others in the community? Contact us on Slack or by email