Function Signature
function getPairing ( name : string ) : PairingData | undefined
Description
Retrieves a single font pairing by its unique identifier. This function searches through the Fonttrio registry and returns the matching pairing configuration, or undefined if no pairing with the given name exists.
Parameters
The unique identifier of the pairing to retrieve. Examples include:
"agency" - Nordic minimalism with Schibsted Grotesk
"architect" - Structured design with Outfit
"minimal" - Clean, modern aesthetics
Name matching is case-sensitive and must match exactly.
Return Value
Returns the matching PairingData object if found, or undefined if no pairing exists with the given name. Show PairingData properties
Unique identifier for the pairing
Font family name for headings
Category of the heading font: "serif", "sans-serif", or "monospace"
Font family name for body text
Category of the body font: "serif", "sans-serif", or "monospace"
Font family name for monospace/code text
Array of mood tags describing the aesthetic
Array of recommended use cases
Human-readable description of the pairing
Complete typography scale with h1-h6 and body configurations
Ready-to-use Google Fonts URL
Usage Examples
Basic Usage
With Error Handling
Apply Typography Scale
Load Google Fonts
React Component
import { getPairing } from '@/lib/pairings' ;
const agencyPairing = getPairing ( 'agency' );
if ( agencyPairing ) {
console . log ( `Heading: ${ agencyPairing . heading } ` );
console . log ( `Body: ${ agencyPairing . body } ` );
} else {
console . log ( 'Pairing not found' );
}
Example Response
{
"name" : "architect" ,
"heading" : "Outfit" ,
"headingCategory" : "sans-serif" ,
"body" : "Libre Baskerville" ,
"bodyCategory" : "serif" ,
"mono" : "IBM Plex Mono" ,
"mood" : [ "structured" , "professional" ],
"useCase" : [ "portfolio" , "agency" , "architecture" ],
"description" : "Structured meets refined. Outfit's geometric precision in headings contrasts beautifully with Libre Baskerville's warm readability, like blueprints meeting handwritten notes." ,
"scale" : {
"h1" : {
"size" : "2.5rem" ,
"weight" : 700 ,
"lineHeight" : "1.1" ,
"letterSpacing" : "-0.03em"
},
"h2" : {
"size" : "2rem" ,
"weight" : 600 ,
"lineHeight" : "1.15" ,
"letterSpacing" : "-0.025em"
},
"body" : {
"size" : "1rem" ,
"lineHeight" : "1.6" ,
"weight" : 400
}
},
"googleFontsUrl" : "https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Libre+Baskerville:wght@400;700&family=IBM+Plex+Mono:wght@400;500&display=swap"
}
Notes
Case Sensitivity : Pairing names are case-sensitive. "Agency" will not match "agency". Always use lowercase names as defined in the registry.
Performance : This function uses Array.find() which has O(n) complexity. For repeated lookups, consider caching the result or using a Map-based lookup if you need frequent access.
Always check for undefined before using the returned value. TypeScript will help enforce this check at compile time.