The single text properties of Chassis Tokens, from font families named by their job to the size and line height of each text role.
This page is a work in progress. Parts of it may be incomplete or differ from the current version of Chassis Tokens.
Introduction
The token sets that this page names are the Chassis token system, as chassis-tokens init writes it into a repository of tokens. Once written, the token sets belong to the repository, which changes them as it needs.
Typography tokens hold the single properties of a text style. Each property has a group under typography.*: fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, and paragraphSpacing. The font tokens combine these properties into text styles. Text case and text decoration have no typography tokens, and no font token names one.
The font families are named by their job, not by their typeface: ui for components, prose for reading content, display for display text, code for code, and icon for the icon font. A brand chooses the typeface of each job. ui, prose, and display have a full scale of sizes, line heights, weights, and letter spacing, and code has a short one. A text role can set its text in any of these families.
Token levels
Typography tokens have no levels. The scales of ui and code hold values of their own. The sizes and line heights of prose reference those of ui step by step, so a reading font has the sizes of ui. Its weights and its letter spacing hold values of their own, because a weight belongs to its typeface. The context group holds the text roles, such as h1, lead, and title-large. Each role holds its own font size, line height, and letter spacing, and each role group, such as heading or title, references a family and a weight. The font.* tokens are the next step: they reference the typography tokens property by property.
A brand gives the text its character by overriding the font families and the font weights in its own token set. It moves a role group to another family by overriding the family and the weight of that group, and it retunes a role by overriding its size, line height, or letter spacing. A repository that adds the optional screen group gives each screen a token set, for the font sizes that differ per screen. No token set of a theme or an app that init writes declares a typography token.
| Tokens | Token set |
|---|---|
typography.fontFamily.*, typography.fontWeight.* | source/base/brand-base.json, overridden by the brand-base.json of a brand, such as source/brand-acme/brand-base.json |
typography.fontSize.*, typography.lineHeight.*, typography.letterSpacing.*, typography.paragraphSpacing.* | source/base/brand-base.json, which the brand-base.json of a brand can override too |
Font families
A font family token holds a list of font families: the font of the brand first, then its fallbacks. Each family token names a job, and the font tokens of a job take their family from it.
| Token | Purpose |
|---|---|
typography.fontFamily.ui | The family of components: font.ui.* and every component font |
typography.fontFamily.prose | The family of reading content, such as the body of an article: font.prose.* |
typography.fontFamily.display | The family of display text, for its scale and for the role groups that a brand points at it |
typography.fontFamily.code | The family of code: font.code.* |
typography.fontFamily.icon | The family of the icon font |
typography.fontFamily.prose references {typography.fontFamily.ui} in source/base/brand-base.json, so the reading content of a brand that has no reading font of its own is set in its ui family.
The context group holds one family per role group of font.context.*. Every role of a group shares its family: typography.fontFamily.context.heading is the family of font.context.h1 to font.context.h6, and typography.fontFamily.context.title the family of the three sizes of font.context.title.*.
| Token | Reference |
|---|---|
typography.fontFamily.context.jumbo | {typography.fontFamily.display} |
typography.fontFamily.context.hero | {typography.fontFamily.display} |
typography.fontFamily.context.heading | {typography.fontFamily.display} |
typography.fontFamily.context.lead | {typography.fontFamily.prose} |
typography.fontFamily.context.blockquote | {typography.fontFamily.prose} |
typography.fontFamily.context.cite | {typography.fontFamily.prose} |
typography.fontFamily.context.body | {typography.fontFamily.prose} |
typography.fontFamily.context.title | {typography.fontFamily.prose} |
typography.fontFamily.context.label | {typography.fontFamily.ui} |
A brand overrides the families whose typeface it changes, each with the weights of that family, and it can point a role group at another family. typography.fontFamily.icon names the icon font, and a brand keeps it as it is unless it ships an icon font of its own.
Font weights
Font weight tokens name the weights of a family by role, not by weight. They follow the pattern typography.fontWeight.<family>.<role>: the families ui, prose, and display have the roles normal, strong, mass, and elegant, and the family code has normal and strong. Each holds the weight that the brand gives to the role, so typography.fontWeight.ui.strong can be a heavier weight in one brand than in another.
The value of a font weight token is the style name that the font has in Figma. A style name can name a weight and a style, such as an italic. The build splits every font weight token into two tokens, <token>.weight and <token>.style: typography.fontWeight.ui.strong becomes typography.fontWeight.ui.strong.weight and typography.fontWeight.ui.strong.style. A style name that names no style gets the style normal.
Fonts spell their style names in their own way, so the same weight can be written with or without a space in two token sets. The build reads both spellings as the same weight.
A weight belongs to the typeface of its family. The weights of prose hold the style names of the reading font, and those of ui the style names of the font of components, so a reading font can have a weight that the font of components lacks, even where typography.fontFamily.prose references {typography.fontFamily.ui}. A brand that sets a family sets its weights in the same token set, and every font token and role group takes its weight from the family that it takes its family from. chassis-tokens lint-source fails on a family set without its weights, and on a weight of another family.
The context group holds one weight per role group, which every role of the group shares. Each references a weight of the family of its group, so it follows the brand.
| Token | Reference |
|---|---|
typography.fontWeight.context.jumbo | {typography.fontWeight.display.strong} |
typography.fontWeight.context.hero | {typography.fontWeight.display.strong} |
typography.fontWeight.context.heading | {typography.fontWeight.display.strong} |
typography.fontWeight.context.lead | {typography.fontWeight.prose.normal} |
typography.fontWeight.context.cite | {typography.fontWeight.prose.strong} |
typography.fontWeight.context.body | {typography.fontWeight.prose.normal} |
typography.fontWeight.context.title | {typography.fontWeight.prose.strong} |
typography.fontWeight.context.label | {typography.fontWeight.ui.strong} |
typography.fontWeight.context.blockquote is the weight of font.context.blockquote. It holds {typography.fontWeight.prose.elegant} Italic, a reference followed by a style, so it follows the elegant weight of the brand and names the italic of that weight.
Font sizes
A font size token holds a size in design pixels. The tokens follow the pattern typography.fontSize.<group>.<step>. The scales of ui and code hold sizes of their own, the scales of prose and display reference the scale of ui, and the context group holds one size per text role.
| Tokens | Steps |
|---|---|
typography.fontSize.ui.* | 6xlarge, 5xlarge, 4xlarge, 3xlarge, 2xlarge, xlarge, large, medium, small, xsmall, 2xsmall |
typography.fontSize.prose.* | The steps of ui, each referencing the step of ui with the same name |
typography.fontSize.display.* | The steps of ui, each referencing the step of ui with the same name |
typography.fontSize.code.* | xlarge, large, medium, small, xsmall |
typography.fontSize.context.* | The name of a text role, such as h1 or title-large |
Each step of a scale is larger than the step after it in the list, from 6xlarge down to 2xsmall. The size of each role is in Text roles.
Line heights
A line height token holds the line height of the font size with the same name, in design pixels: typography.lineHeight.ui.medium belongs to typography.fontSize.ui.medium, and typography.lineHeight.context.h1 to typography.fontSize.context.h1. The groups ui, prose, display, and code have a line height for each of their font sizes, and the line heights of prose and display reference those of ui. The context group has one for each role. Every line height is larger than its font size.
A line height belongs to its role, not to its family: a heading is set tighter than the body of an article in the same family, so the roles hold line heights of their own. They are in design pixels and not in ratios of the font size, because a line height in whole pixels keeps the lines of a text on the pixel grid in Figma, and a ratio puts them between pixels.
Letter spacing
Letter spacing tokens hold the space between letters in design pixels, the unit that a Figma variable holds. A pixel value is the same at every font size, so the letter spacing belongs to a size, as the line height does. The families ui, prose, and display have one letter spacing per weight, typography.letterSpacing.<family>.<weight>, and a base token of each size references the letter spacing of its weight: font.ui.medium.strong references {typography.letterSpacing.ui.strong}. font.code.* references typography.letterSpacing.base.zero. The family code has no letter spacing of its own.
| Token | Reference |
|---|---|
typography.letterSpacing.base.zero | {size.unit.0} |
typography.letterSpacing.ui.normal | {size.unit.0} |
typography.letterSpacing.ui.strong | {size.unit.0} |
typography.letterSpacing.ui.mass | {size.unit.0} |
typography.letterSpacing.ui.elegant | {size.unit.0} |
typography.letterSpacing.prose.normal | {size.unit.0} |
typography.letterSpacing.prose.strong | {size.unit.0} |
typography.letterSpacing.prose.mass | {size.unit.0} |
typography.letterSpacing.prose.elegant | {size.unit.0} |
typography.letterSpacing.display.normal | {size.unit.0} |
typography.letterSpacing.display.strong | {size.unit.0} |
typography.letterSpacing.display.mass | {size.unit.0} |
typography.letterSpacing.display.elegant | {size.unit.0} |
The context group holds one letter spacing per text role, under the name of the role, such as typography.letterSpacing.context.title-large. Each references {size.unit.0} in source/base/brand-base.json. A brand tightens the letters of a role by referencing a negative step of the size scale, such as {size.unit.n1} for jumbo and hero. Figma variables cannot hold a percentage, so chassis-tokens lint-source fails on a letter spacing in percent or in em.
Paragraph spacing
Paragraph spacing tokens hold the space after a paragraph, as a size in design pixels. They are in source/base/brand-base.json, so a brand can change them. Each step from small to large is larger than the one before.
| Token | Purpose |
|---|---|
typography.paragraphSpacing.base.zero | No space: every font token that the other steps do not name |
typography.paragraphSpacing.base.small | The small size of font.context.body.* and font.context.title.* |
typography.paragraphSpacing.base.medium | The medium size of the same roles |
typography.paragraphSpacing.base.large | The large size of the same roles |
Text roles
The context group holds the text roles of font.context.*, in source/base/brand-base.json. A role is named after the element or the content that it sets. It holds its own font size, line height, and letter spacing under its name, such as typography.fontSize.context.title-large, and takes its family and its weight from its role group, which the roles of the group share.
| Roles | Role group | Purpose |
|---|---|---|
jumbo | jumbo | The largest display text of a page |
hero | hero | The title of a hero section |
h1, h2, h3, h4, h5, h6 | heading | The headings, one role per heading element |
lead | lead | The paragraph that opens an article or a page |
blockquote | blockquote | A quotation |
cite | cite | The source of a quotation |
body-large, body-medium, body-small | body | Running text of reading content |
title-large, title-medium, title-small | title | Titles inside content and components |
label-large, label-medium, label-small | label | Labels of controls and form fields |
The size of jumbo references {size.unit.96}, and the size of hero references {size.unit.64}; the other roles hold sizes of their own. Every role holds its line height in design pixels, so a brand that changes the size of a role changes its line height too. The default families of the role groups are in Font families, and their weights in Font weights.
Usage
Set text with a font token, which holds every property of a text style. Use a typography token where one property is needed on its own: typography.fontFamily.ui for the font family of an interface, typography.fontFamily.prose for the body of an article, typography.fontWeight.ui.strong for emphasis inside a text.
Take the font size and the line height from the same step or role. typography.lineHeight.ui.large is made for typography.fontSize.ui.large, and the web output of a line height is relative to the font size of the same name.
Give a brand its own fonts by overriding typography.fontFamily.* and typography.fontWeight.* in the token set of the brand. Every font token follows, because the font tokens hold references. Set a family and its weights together: the weights are the style names of that typeface. An override of a family can be a reference too. A brand that sets its display text in its reading typeface would hold in source/brand-globex/brand-base.json the family, and next to it typography.fontWeight.display.* with the style names of that typeface:
{
"typography": {
"fontFamily": {
"display": {
"$type": "fontFamilies",
"$value": "{typography.fontFamily.prose}"
}
}
}
}Move a role group to another family with two tokens, its family and its weight. A weight names a style of one family, so a brand that moves a group points its weight at a weight of the same family. A brand that sets its titles in its display family would hold in source/brand-acme/brand-base.json:
{
"typography": {
"fontFamily": {
"context": {
"title": {
"$type": "fontFamilies",
"$value": "{typography.fontFamily.display}"
}
}
},
"fontWeight": {
"context": {
"title": {
"$type": "fontWeights",
"$value": "{typography.fontWeight.display.strong}"
}
}
}
}
}The two tokens change every role of the group: font.context.title.large, font.context.title.medium, and font.context.title.small follow typography.fontFamily.context.title and typography.fontWeight.context.title.
Retune a role by overriding its own tokens: typography.fontSize.context.h2 and typography.lineHeight.context.h2 change font.context.h2 only, and typography.letterSpacing.context.hero tightens font.context.hero. No font token has to change.
Write a font weight as the font names it in Figma, and keep that spelling. chassis-tokens lint-source reports a weight that the build does not know.
Platform output
Line heights, font sizes, and paragraph spacing print as sizes, each platform in its own unit. The other properties print as numbers and strings.
| Platform | Name | Format |
|---|---|---|
| Web | $cx-typography-line-height-ui-medium | A number in em |
| iOS | TypographyLineHeightUiMedium | A CGFloat in points |
| Android | @dimen/typography_line_height_ui_medium | A <dimen> in sp |
The web divides a line height by the font size of the same name, so the line height is relative to the font size. iOS and Android print the line height as a size.
The other properties have these formats.
| Tokens | Web | iOS | Android |
|---|---|---|---|
typography.fontFamily.* | The list of families, as the token holds it | A string with the first family of the list | A <string> with the first family of the list |
typography.fontWeight.*.weight | A number from 100 to 900 | A case of UIFont.Weight | An <integer> from 100 to 900 |
typography.fontWeight.*.style | A keyword | A string | A <string> |
typography.fontSize.* | A size in rem | A CGFloat in points | A <dimen> in sp |
typography.letterSpacing.* | A size in rem | A CGFloat in points | An <item> of the type dimen with the format float, in design pixels |
typography.paragraphSpacing.* | A size in rem | A CGFloat in points | A <dimen> in sp |
The build prints the two tokens of a font weight under their own names, such as $cx-typography-font-weight-ui-strong-weight and $cx-typography-font-weight-ui-strong-style on the web.
On the web, the family and the weight of a role group print the custom property of Chassis CSS for the family token they reference: $cx-typography-font-family-context-title is var(--font-family-prose) in the token sets that init writes, and var(--font-family-display) in a brand that points the group at its display family. Chassis CSS declares the custom property of the role group from it, so a brand changes the family of a group in one place. A role group that holds more than a reference, such as the weight of blockquote, prints the value. iOS and Android print the family and the weight that the role group leads to.
The web writes the families and weights to string.scss, and the sizes, line heights, and spacings to the number file, one per screen when the repository has screens; main.scss holds all of them. iOS and Android split the tokens the same way between their string and number files.
See the web, iOS, and Android docs for the files that hold these names.