@cloudillo/fonts
Overview
The @cloudillo/fonts library provides a curated collection of Google Fonts metadata and pairing suggestions for Cloudillo applications. It enables font selection UIs, typography systems, and design tools.
Key Features:
- Curated font metadata for 22 Google Fonts
- Pre-defined font pairings (heading + body combinations)
- Helper functions for filtering and lookup
- Full TypeScript support
Installation
Font Metadata API
FONTS Constant
The FONTS array contains metadata for all available fonts.
Each font entry includes:
family- CSS font-family value (e.g.,'Roboto')displayName- Human-readable namecategory-'sans-serif' | 'serif' | 'display' | 'monospace'roles- Suitable uses:'heading' | 'body' | 'display' | 'mono'weights- Available font weightshasItalic- Whether italic variants existlicense-'OFL'or'Apache-2.0'directory- Font directory name
getFontByFamily
Look up a font by its family name.
getFontsByCategory
Filter fonts by category.
Available categories:
sans-serif- Clean, modern fonts (Roboto, Open Sans, Montserrat, etc.)serif- Traditional fonts with serifs (Playfair Display, Merriweather, etc.)display- Decorative fonts for headlines (Oswald, Bebas Neue, etc.)monospace- Fixed-width fonts (JetBrains Mono)
getFontsByRole
Filter fonts by intended use.
Available roles:
heading- Suitable for titles and headingsbody- Suitable for body textdisplay- Decorative, for large display textmono- Monospace, for code
Font Pairings API
The library includes curated heading + body font combinations that work well together.
FONT_PAIRINGS Constant
Available pairings:
| ID | Name | Heading | Body | Description |
|---|---|---|---|---|
modern-professional |
Modern Professional | Oswald | Roboto | Business presentations |
elegant-editorial |
Elegant Editorial | Playfair Display | Source Sans 3 | Articles and long-form |
clean-modern |
Clean Modern | Montserrat | Open Sans | Tech and startups |
readable-classic |
Readable Classic | Merriweather | Lato | Blogs and docs |
contemporary-tech |
Contemporary Tech | Poppins | Inter | Digital products |
literary-warm |
Literary Warm | Lora | Nunito Sans | Classic with friendly body |
light-minimalist |
Light Minimalist | Raleway | Work Sans | Minimal designs |
academic-formal |
Academic Formal | Crimson Pro | DM Sans | Scholarly content |
bold-impact |
Bold Impact | Bebas Neue | Source Serif 4 | Impactful headlines |
geometric-harmony |
Geometric Harmony | DM Serif Display | DM Sans | Cohesive DM family |
getPairingById
Look up a specific pairing.
getPairingsForFont
Find pairings that use a specific font.
getSuggestedBodyFonts
Get body font suggestions for a heading font.
getSuggestedHeadingFonts
Get heading font suggestions for a body font.
TypeScript Types
FontCategory
FontRole
FontWeight
FontMetadata
FontPairing
Integration with FontPicker
The @cloudillo/fonts library works with the FontPicker component from @cloudillo/react.
Available Fonts
Sans-Serif
| Font | Roles | Weights |
|---|---|---|
| Roboto | body, heading | 400, 700 |
| Open Sans | body | 400, 700 |
| Montserrat | heading, body | 400, 700 |
| Lato | body | 400, 700 |
| Poppins | heading, body | 400, 700 |
| Inter | body | 400, 700 |
| Nunito Sans | body | 400, 700 |
| Work Sans | body | 400, 700 |
| Raleway | heading | 400, 700 |
| DM Sans | body | 400, 700 |
| Source Sans 3 | body | 400, 700 |
Serif
| Font | Roles | Weights |
|---|---|---|
| Playfair Display | heading, display | 400, 700 |
| Merriweather | heading, body | 400, 700 |
| Lora | heading, body | 400, 700 |
| Crimson Pro | heading, body | 400, 700 |
| Source Serif 4 | body | 400, 700 |
| DM Serif Display | heading, display | 400 |
Display
| Font | Roles | Weights |
|---|---|---|
| Oswald | heading, display | 400, 700 |
| Bebas Neue | heading, display | 400 |
| Abril Fatface | display | 400 |
| Permanent Marker | display | 400 |
Monospace
| Font | Roles | Weights |
|---|---|---|
| JetBrains Mono | mono | 400, 700 |
See Also
- React Components - Including FontPicker component
- @cloudillo/react - React integration library