{"id":3203,"date":"2024-08-05T09:07:03","date_gmt":"2024-08-05T14:07:03","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=3203"},"modified":"2024-08-05T09:07:04","modified_gmt":"2024-08-05T14:07:04","slug":"figma-typography-variables","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/figma-typography-variables\/","title":{"rendered":"Figma Typography Variables"},"content":{"rendered":"\n<p>When we were recording the \u201c<a href=\"https:\/\/frontendmasters.com\/courses\/figma-v2\/?utm_source=boost&amp;utm_medium=blog&amp;utm_campaign=boost\">Figma for Developers, v2<\/a>\u201d workshop, I mentioned that <a href=\"https:\/\/stevekinney.net\/courses\/figma\/variables\">Variables<\/a> were in beta and that they couldn&#8217;t be used with typography <em>yet<\/em>. Coincidentally, typography support was added the next day after the recording. Figma variables are also no longer in beta.<\/p>\n\n\n\n<p>Let the record show, I <em>was<\/em> correct during the recording\u2014and that&#8217;s the important part, right? Let\u2019s review what <a href=\"https:\/\/help.figma.com\/hc\/en-us\/articles\/15339657135383-Guide-to-variables-in-Figma\">Figma Variables<\/a> are, then explore how to use them with your typography system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Brief Review of Variables in Figma<\/h2>\n\n\n\n<p>In Figma, Variables are placeholders for reusable values\u2014just like JavaScript. These values include colors, numeric values, and more. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"452\" height=\"434\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/variable-types.png?resize=452%2C434&#038;ssl=1\" alt=\"Variable dropdown includes Color, Number, String, and Boolean\" class=\"wp-image-3228\" style=\"width:235px;height:auto\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/variable-types.png?w=452&amp;ssl=1 452w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/variable-types.png?resize=300%2C288&amp;ssl=1 300w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><figcaption class=\"wp-element-caption\">The variable types in Figma<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Once set, you can use them across different design elements in your Figma designs. Variables can also be shared with your team and used across multiple Figma files. This makes it easy to make sweeping changes to your design system with a few button clicks.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdp1dVgO640IRj9_fz2jOpCGPaYVJJ-TzfAU5ecM5YgfmlAkNl2yPgQyBL8PdXO_o00_q1YAbfRt6-Dbmkq4hcoCEx2Op5aiEMUMKCtXe-s65yYDkcYZNVD2jNGa8zUmWoaqNBhBbLBorfOn0UuUO6qm8d3?key=JEzw8vEthqpSsj51E-at1Q\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Using Variables to Control Typography in Figma<\/h2>\n\n\n\n<p>Previously, Figma&#8217;s variables were great for colors and spacing, ensuring consistency. However, we lacked the same flexibility with fonts. We had to use various styles and components for different themes or brands. Styles are still incredibly useful, but they lack the ability to change a <em>single<\/em> value used by multiple styles. <strong>This makes a task like switching a font incredibly tedious as you\u2019d have to update every single style.<\/strong> In the course, we explored some approaches using various plugins in an attempt to automate this process, but the constraint was still there. This was a significant limitation and meant that we had to combine multiple approaches in order to maintain consistency throughout our design system.<\/p>\n\n\n\n<p>Now that variables can be used with typography, you can now define variables for font settings. Figma now supports using variables for the following properties:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>font family<\/li>\n\n\n\n<li>font weight &amp; style<\/li>\n\n\n\n<li>font size<\/li>\n\n\n\n<li>line height<\/li>\n\n\n\n<li>letter spacing<\/li>\n\n\n\n<li>paragraph spacing &amp; indentation<\/li>\n<\/ul>\n\n\n\n<p>Each of these properties can be controlled using the same variable types that we saw when we walked through variables during the course, with numbers and strings being the most pertinent for defining typography properties. For example, you can use a string variable to define the font family.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"479\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-1.png?resize=1024%2C479&#038;ssl=1\" alt=\"\" class=\"wp-image-3210\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-1.png?resize=1024%2C479&amp;ssl=1 1024w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-1.png?resize=300%2C140&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-1.png?resize=768%2C359&amp;ssl=1 768w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-1.png?resize=1536%2C719&amp;ssl=1 1536w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-1.png?w=1556&amp;ssl=1 1556w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>With the values set, you can select a variable when selecting the font family in the left-side panel in the Figma canvas. Changing the variable will now change all text in your designs that reference this variable, allowing you to <strong>quickly make changes across your entire design by updating a single value.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"488\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-2.png?resize=1024%2C488&#038;ssl=1\" alt=\"\" class=\"wp-image-3211\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-2.png?resize=1024%2C488&amp;ssl=1 1024w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-2.png?resize=300%2C143&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-2.png?resize=768%2C366&amp;ssl=1 768w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-2.png?resize=1536%2C732&amp;ssl=1 1536w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-2.png?w=1600&amp;ssl=1 1600w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>Here&#8217;s a quick video demonstrating setting a block of text to a variable, then changing that variable:<\/p>\n\n\n\n\t\t<figure class=\"wp-block-jetpack-videopress jetpack-videopress-player\" style=\"\" >\n\t\t\t<div class=\"jetpack-videopress-player__wrapper\"> <iframe title=\"VideoPress Video Player\" aria-label='VideoPress Video Player' width='500' height='386' src='https:\/\/videopress.com\/embed\/Zfkm50HO?cover=1&amp;autoPlay=0&amp;controls=1&amp;loop=0&amp;muted=1&amp;persistVolume=0&amp;playsinline=0&amp;preloadContent=metadata&amp;useAverageColor=1&amp;hd=0' frameborder='0' allowfullscreen data-resize-to-parent=\"true\" allow='clipboard-write'><\/iframe><script src='https:\/\/v0.wordpress.com\/js\/next\/videopress-iframe.js?m=1674852142'><\/script><\/div>\n\t\t\t\n\t\t\t\n\t\t<\/figure>\n\t\t\n\n\n<p>There are still a few limitations. For example, variables don&#8217;t support percentages for line heights. Variables also don&#8217;t autocomplete for spacing or line height. Hopefully, Figma will address these soon.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Variables with Modes<\/h2>\n\n\n\n<p>In the course, we used Variable Modes to switch between light and dark themes as well as different responsive breakpoints. This approach also works with our new typography variables allowing your variables to point to different variables depending on what mode you&#8217;re in.<\/p>\n\n\n\n<p>Imagine managing font sizes for different viewports. Create a \u201cTypography\u201d collection in the variables editor. We\u2019ll create two modes: Desktop and Mobile. Depending on which mode we\u2019re using the variables will have one of two values as seen in the screenshot below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"330\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-3.png?resize=1024%2C330&#038;ssl=1\" alt=\"\" class=\"wp-image-3212\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-3.png?resize=1024%2C330&amp;ssl=1 1024w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-3.png?resize=300%2C97&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-3.png?resize=768%2C248&amp;ssl=1 768w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-3.png?resize=1536%2C495&amp;ssl=1 1536w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-3.png?w=1600&amp;ssl=1 1600w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>With these changes, we can switch to a smaller set of font sizes when designing for mobile. If we need to change the font size across all of our mobile views, we can simply update the appropriate variable.&nbsp;<\/p>\n\n\n\n<p>One thing that&nbsp; makes variable modes powerful is that any layer set to <strong>Auto<\/strong> will inherit the any mode set on the parent. This means that if you switch the mode of the frame containing multiple text elements from Desktop to Mobile, all of your typography will automatically update to the values defined in the Mobile mode.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"553\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-4.png?resize=1024%2C553&#038;ssl=1\" alt=\"\" class=\"wp-image-3214\" style=\"width:611px;height:auto\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-4.png?resize=1024%2C553&amp;ssl=1 1024w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-4.png?resize=300%2C162&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-4.png?resize=768%2C415&amp;ssl=1 768w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-4.png?w=1156&amp;ssl=1 1156w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n<\/div>\n\n\n<p>Being able to support different font sizes and spacing across viewports is the most compelling application of typography variables for me, personally. But, they could also be useful if you had to support multiple brands or themes in your design system.&nbsp;<\/p>\n\n\n\n<p>For example, you could have a different mode for each brand theme you support. You could also define different font families for your Android application as opposed to your iOS application. You could even define different font sizes for your marketing website as opposed to your application&#8217;s user interface.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What About Styles?<\/h2>\n\n\n\n<p>Prior to supporting variables within typography in Figma, we used <a href=\"https:\/\/stevekinney.net\/courses\/figma\/styles\">Styles<\/a>\u2014and these are still useful. A variable can represent one value. Styles, however, can store a composite of values (e.g. font family, size, and line height). This gives us the ability to use variables as primitives, define the font, size, and spacing for our typography and then save that combination as a style.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"794\" height=\"676\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-5.png?resize=794%2C676&#038;ssl=1\" alt=\"\" class=\"wp-image-3215\" style=\"width:485px;height:auto\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-5.png?w=794&amp;ssl=1 794w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-5.png?resize=300%2C255&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed-5.png?resize=768%2C654&amp;ssl=1 768w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/figure>\n<\/div>\n\n\n<p><strong>It&#8217;s less about whether to use styles <em>o<\/em>r variables and more about how to use styles <em>and<\/em> variables.<\/strong> What&#8217;s really cool about this is that you can use a single variable as part of a number of different types. Updating that variable will then immediately update every style that relies on that variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">In Conclusion<\/h2>\n\n\n\n<p>Introducing variable support for typography in Figma is definitely a welcome change that we&#8217;re already beginning to leverage in our internal design system at Temporal. Variables now unifies colors, spacing, and typography using a single approach. Combining variables with styles is powerful, as well. Variables allow for individual changes, while styles provide preset options. This mix helps us build and update design systems with a lot less hassle.<\/p>\n\n\n\n<p>That said, some features are missing, such as percentage line heights and spacing suggestions. But, I suspect those features will be coming soon and I&#8217;ll have to update this yet again.<\/p>\n\n\n\n<p>In the meantime, I encourage you to take the typography in one of your existing designs and update using typography variables. I suspect you&#8217;ll be pleasantly surprised with how easy they are to work with.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Figma has support for variables, and they work with the various typography features you may want to set. For instance, you could create a variable called &#8220;Header Font&#8221; with a value of &#8220;Ideal Sans&#8221; and use it in many places.<\/p>\n","protected":false},"author":30,"featured_media":3209,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[81,24,219,39],"class_list":["post-3203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-post","tag-color","tag-design","tag-figma","tag-typography"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/unnamed.png?fit=1600%2C954&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/3203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=3203"}],"version-history":[{"count":11,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/3203\/revisions"}],"predecessor-version":[{"id":3379,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/3203\/revisions\/3379"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/3209"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=3203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=3203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=3203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}