Description
Generates classes for responsive typography sets. The idea being that instead of manually setting font settings for every breakpoint - you would instead have a responsive system set up.
Similiar to responsive spacing, at AREA 17 we like responsive typesets classes so that the type across a site can be known and predictable. We define our type system and then use them consistently across a site. We never have a unique type style or a unique style at a breakpoint - everything is part of the system.
Setup
In addition to the required $structure
map (Setup), you should add a $typography
map to your _tokens.scss
, with the following format:
Settable type properties
You can set any CSS key/value type for fonts/text styles and also two some special, none standard font properties you can set:
bold-weight
- sets a variable of--bold-weight
and sets anyb
orstrong
children of the element to usefont-weight: var(--bold-weight);
to give you control over the font weightsfont-smoothing
-true
orfalse
, setsantialiased
andsubpixel-antialiased
Output
Based on the reference config mentioned in this guide, for the typeset named h1
we'd get the following in our CSS:
Similarly for the typeset named h1
we would get classes for each of the other typesets - in this guide that would include f-h2
, f-body
etc.
Demo
Based on the reference config mentioned in this guide, we would get the following in our CSS:
f-h1 The quick brown fox jumps over the lazy dog
f-h2 The quick brown fox jumps over the lazy dog
f-body The quick brown fox jumps over the lazy dog
These font styles can also be applied via SCSS @include typeset(name)
:
These font styles can also be applied via SCSS @extend
:
Notes
As you can see, this generates a reasonable number of CSS classes - you will want to purge your CSS of unused classes to remove any of these that you don't use.
Alternatively, if you don't want to generate the CSS classes, see CSS-Class-Generation.