Fonts and scripts
What loads
| Import | Fonts |
|---|---|
@peleda-app/tokens/fonts.css | Geist, Geist Mono and fonts-scripts.css |
@peleda-app/tokens/fonts-scripts.css | Noto Sans, Noto Sans Mono and Noto Sans Arabic, Hebrew, Devanagari, Bengali, Tamil, Thai, SC, JP and KR |
@peleda-app/tokens/fonts-all.css | everything in fonts.css, plus Inter, Atkinson Hyperlegible Next, Lexend, OpenDyslexic, IBM Plex Sans, Mono and Serif |
index.css imports fonts.css. All fonts are Fontsource packages with unicode-range subsets, so a page downloads only the files for the characters it shows.
Font stacks
The theme writes the primary family and appends var(--pl-font-scripts), the Noto families, before the system fallback:
--pl-font-sans: 'Geist Variable', 'Geist', var(--pl-font-scripts), system-ui, sans-serif;Latin, Greek and Cyrillic come from the primary font when it has them, and everything else falls through to Noto. Under :lang(ja) and :lang(ko) the order of the CJK families changes, so shared Han characters take the Japanese or Korean forms.
The sans option picks the primary family: geist, inter, plex (IBM Plex Sans), atkinson (Atkinson Hyperlegible Next), lexend, opendyslexic or system. mono picks geist, plex or system, and display sets headings to the sans, IBM Plex Serif or the mono family.
Line height and spacing per language
tokens.css sets two factors from the lang attribute, and every text-* utility multiplies its line height and letter spacing by them:
| Languages | --pl-leading-script | --pl-tracking-scale |
|---|---|---|
| default | 1 | 1 |
| Chinese, Japanese, Korean | 1.15 | 0 |
| Arabic, Persian, Urdu, Pashto | 1.3 | 0 (also no extra tracking) |
| Hebrew, Yiddish | 1.1 | 0 |
| Indic and Southeast Asian scripts (Bengali, Hindi, Marathi, Nepali, Tamil, Telugu, Kannada, Malayalam, Gujarati, Punjabi, Sinhala, Thai, Lao, Khmer, Burmese) | 1.35 | 0 |
Set lang on the element that holds the text, not only on <html>, when a page mixes languages.
Rules for components
- Elements with text never get a fixed height: use
min-h-*with vertical padding, so taller scripts grow instead of clipping. - Every flex or grid child with user text has
min-w-0and choosestruncate,line-clamp-Nor wrapping withbreak-wordsor[overflow-wrap:anywhere]. - Only logical utilities:
ms-*,me-*,ps-*,pe-*,start-*,end-*,border-s,border-e,rounded-s,rounded-e,text-start,text-end. Directional icons flip withrtl:-scale-x-100. - User strings sit in
<bdi>or getdir="auto". Codes, times and numbers that must stay left to right getdir="ltr". - No
uppercaseon content that may be non-Latin, except short captions.
Testing
The Storybook toolbar has a Locale menu that sets lang and dir on <html>: English, a stress test with very long words, URLs and names, Russian, German, Greek, Arabic and Hebrew in RTL, Chinese, Japanese, Korean, Bengali, Hindi, Tamil, Thai and mixed bidi text with emoji. Stories read their text with sampleFor(globals) from @peleda-app/storybook-kit/samples, and each component has Localized and LongText stories.