Frontend Recipes

Typography

The type scale, and how to set your own face.

Type does not ship with the library. --fr-font-sans defaults to the platform UI face, and the type scale is built to work with any reasonable sans — components are sized and weighted, not tied to a typeface.

The stack

css
--fr-font-sans: system-ui, -apple-system, "Segoe UI", Roboto,
  "Helvetica Neue", Arial, sans-serif;
--fr-font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

The default is deliberate: a component you pasted in should look right on first render, before you have made a typographic decision. When you have one, override the single token:

css
:root {
  --fr-font-sans: "Your Face", system-ui, sans-serif;
}

Mono is used for three things only: code, the character counter under a textarea, and numeric table cells that need to align. Using mono for emphasis is not part of the system.

The scale

Seven steps. Every one is a token, and no component invents a size outside this list.

Display
56 / 57
--fr-text-display
Recipes for interfaces
Heading 1
40 / 46
--fr-text-h1
Recipes for interfaces
Heading 2
28 / 32
--fr-text-h2
Recipes for interfaces
Heading 3
20 / 23
--fr-text-h3
Recipes for interfaces
Body
15 / 24
--fr-text-body
Recipes for interfaces
Small
13 / 20
--fr-text-small
Recipes for interfaces
Micro
11 / 13
--fr-text-micro
Recipes for interfaces

Weights

Four weights, all tokens. Nothing in the library synthesises a bold.

400The quick brown fox jumps over the lazy dog
500The quick brown fox jumps over the lazy dog
600The quick brown fox jumps over the lazy dog
700The quick brown fox jumps over the lazy dog

Headings are 600, never 700. At these sizes, bold reads as shouting, and the hierarchy already comes from size and the rules above each section.

Uppercase micro-labels

The micro-label is the smallest step in the scale: 11px, semibold, 0.08em tracking, uppercase.

Getting started — components — on this page

It is a utility, not a structural device. The Badge label uses it; the docs site does not put it above headings or section titles, because a small all-caps label above every heading turns hierarchy into decoration.

Use it for one to three words inside a bordered marker. A micro-label that wraps is a paragraph pretending to be a label.

Measure

Body copy is constrained to --fr-measure (68 characters). Prose on this site is constrained to the same value, which is why the documentation column does not stretch on a wide monitor.

Choosing a face

The scale is drawn around a large x-height and closed apertures, which is what keeps an 11px micro-label legible. A face with a small x-height wants the micro-label raised to 12px and the tracking tightened to 0.05em. The one thing worth checking before you commit: uppercase at 11px, in your face, on your ground.