Skip to main content

Function Signature

Description

Filters and returns all font pairings where the heading font matches the specified category. This is useful when you want to enforce a specific typographic style for headings, such as all serif headings for a traditional look or sans-serif for modern designs. The function filters based on the headingCategory property, not the body font category.

Parameters

FontCategory
required
The font category to filter by. Must be one of:
  • "serif" - Traditional fonts with decorative strokes (e.g., Libre Baskerville, Merriweather)
  • "sans-serif" - Modern fonts without decorative strokes (e.g., Outfit, Schibsted Grotesk)
  • "monospace" - Fixed-width fonts for code and technical content (e.g., IBM Plex Mono, Fira Code)
Category matching is case-sensitive and must match exactly.

Return Value

PairingData[]
An array of font pairings where the heading font belongs to the specified category. Returns an empty array if no pairings match.Each PairingData object contains:

Usage Examples

Example Response

Notes

Heading Category Only: This function filters by headingCategory, not bodyCategory. The body font may be in a different category, which often creates interesting typographic contrast.
Type Safety: Use the FontCategory type from @/lib/pairings to ensure type safety. Invalid category strings will still execute but return an empty array.
For modern web designs, sans-serif heading categories are most popular. For traditional or editorial designs, consider serif categories.
Performance: This function filters the entire pairings array on each call. Consider caching results if calling repeatedly with the same category.

Common Patterns

Serif Headings

Serif heading fonts create a traditional, authoritative, or editorial feel. Common for:
  • News and magazine sites
  • Academic publications
  • Literary content
  • Traditional brands

Sans-serif Headings

Sans-serif heading fonts create a modern, clean, minimal feel. Common for:
  • Tech startups
  • SaaS products
  • Modern agencies
  • Portfolio sites

Monospace Headings

Monospace heading fonts create a technical, code-focused feel. Common for:
  • Developer tools
  • Technical documentation
  • Code-heavy sites
  • Retro/terminal aesthetics