Configuration
Typography configuration
Font roles, font stacks and Capsize font metrics in 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).
| Prop | Type | Default | Description |
|---|---|---|---|
| ascent(required) | number | — | — |
| capHeight(required) | number | — | — |
| category | string | — | — |
| descent(required) | number | — | — |
| familyName | string | — | Family name; required for fallback fonts (the primary role uses its first family). |
| fullName | string | — | — |
| lineGap(required) | number | — | — |
| postscriptName | string | — | — |
| subsets | Readonly<Record<string, { readonly xWidthAvg: number; }>> | — | — |
| unitsPerEm(required) | number | — | — |
| xHeight | number | — | — |
| xWidthAvg | number | — | 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-facerules. - Families without metrics produce a
missing-metricsdiagnostic and are not trimmed.
Guide: Typography and Capsize.