Skip to content

Font Family

Font family utilities switch the typeface by reading a token. They do not load a font; loading belongs to your @font-face and the token layer.

Class Token
font-sans --nc-font-sans
font-mono --nc-font-mono
font-base --nc-font-base
font-headings --nc-font-headings
font-displays --nc-font-displays

The three role aliases default to the sans stack. Override them to load a display face without changing the body font:

@font-face {
font-family: "Inter";
src: url("/fonts/inter.woff2") format("woff2");
font-weight: 100 900;
font-display: swap;
}
:root {
--nc-font-sans: "Inter", system-ui, sans-serif;
--nc-font-headings: "Inter Display", "Inter", sans-serif;
}
<p class="font-sans">Body copy</p>
<code class="font-mono">const name = "NightCSS";</code>
<h2 class="font-headings">A heading in the heading face</h2>
  • font-mono is for code, identifiers, and tabular values, not for whole paragraphs.
  • Keep the number of families small. One sans, one mono, and optionally one display face is enough for most interfaces.
  • Font family has no breakpoint variants. A different face at a breakpoint is rare and better expressed in a component style.
  • Use font-display: swap so text is readable before the web font arrives.

The class is the markup shorthand. The same style in a component stylesheet:

.body {
font-family: var(--nc-font-sans);
}
.code {
font-family: var(--nc-font-mono);
}

The Sass subpackage exposes the same values: nc.nc-font("sans") and nc.nc-font("mono"). See Sass subpackage.

A breakpoint is the same declaration inside a media query; you do not need a second class.