Skip to Content
Neshel-UI
Configuration

Typography configuration

Font roles, font stacks and Capsize font metrics in neshel.config.ts.

neshel.config.ts
import arial from "@capsizecss/metrics/arial";
import sourceSerif from "@capsizecss/metrics/sourceSerif4";
import { defineConfig } from "@neshel-ui/config";

export default defineConfig({
  typography: {
    families: {
      display: ["Source Serif 4", "Georgia", "serif"],
      mono: ["JetBrains Mono", "ui-monospace", "monospace"],
    },
    metrics: { display: sourceSerif },
    fallbacks: { display: [arial] },
  },
});

FontRole

Font roles exposed as --neshel-font-<role>.

type FontRole = "body" | "display" | "mono"

FontStack

A font family name or an ordered fallback stack. Names with spaces are quoted on output.

type FontStack = string | readonly string[]

FontMetrics

Font metrics in Capsize's format (objects from @capsizecss/metrics can be passed directly). Used by neshel generate for cap-height sizing and trimming (feature 004).

FontMetrics
PropTypeDefaultDescription
ascent(required)number——
capHeight(required)number——
categorystring——
descent(required)number——
familyNamestring—Family name; required for fallback fonts (the primary role uses its first family).
fullNamestring——
lineGap(required)number——
postscriptNamestring——
subsetsReadonly<Record<string, { readonly xWidthAvg: number; }>>——
unitsPerEm(required)number——
xHeightnumber——
xWidthAvgnumber—Average character width; required for fallback font generation.
  • Families become --neshel-font-<role>; names with spaces are quoted on output.
  • Metrics drive cap-height scaling and trimming; fallbacks generate Capsize @font-face rules.
  • Families without metrics produce a missing-metrics diagnostic and are not trimmed.

Guide: Typography and Capsize.

Edit on GitHub