> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/kapishdima/fonttrio/llms.txt
> Use this file to discover all available pages before exploring further.

# getPairingsByMood

> Retrieve font pairings filtered by mood tag

## Function Signature

```typescript theme={null}
function getPairingsByMood(mood: string): PairingData[]
```

## Description

Filters and returns all font pairings that include the specified mood tag. Each pairing can have multiple mood tags, and this function returns all pairings where the specified mood appears in the `mood` array.

Mood tags describe the aesthetic feeling and personality of a font pairing, such as "minimal", "professional", "playful", "elegant", etc.

## Parameters

<ParamField path="mood" type="string" required>
  The mood tag to filter by. Common mood values include:

  * `"minimal"` - Clean, uncluttered aesthetic
  * `"professional"` - Business-appropriate and formal
  * `"nordic"` - Scandinavian-inspired simplicity
  * `"structured"` - Organized and geometric
  * `"playful"` - Fun and creative
  * `"elegant"` - Refined and sophisticated

  Mood matching is case-sensitive and must match exactly.
</ParamField>

## Return Value

<ResponseField name="return" type="PairingData[]">
  An array of font pairings that contain the specified mood tag. Returns an empty array if no pairings match the mood.

  Each `PairingData` object contains:

  <Expandable title="PairingData properties">
    <ResponseField name="name" type="string" required>
      Unique identifier for the pairing
    </ResponseField>

    <ResponseField name="heading" type="string" required>
      Font family name for headings
    </ResponseField>

    <ResponseField name="headingCategory" type="FontCategory" required>
      Category of the heading font: `"serif"`, `"sans-serif"`, or `"monospace"`
    </ResponseField>

    <ResponseField name="body" type="string" required>
      Font family name for body text
    </ResponseField>

    <ResponseField name="bodyCategory" type="FontCategory" required>
      Category of the body font: `"serif"`, `"sans-serif"`, or `"monospace"`
    </ResponseField>

    <ResponseField name="mono" type="string" required>
      Font family name for monospace/code text
    </ResponseField>

    <ResponseField name="mood" type="string[]" required>
      Array of mood tags (includes the searched mood)
    </ResponseField>

    <ResponseField name="useCase" type="string[]" required>
      Array of recommended use cases
    </ResponseField>

    <ResponseField name="description" type="string" required>
      Human-readable description of the pairing
    </ResponseField>

    <ResponseField name="scale" type="TypographyScale" required>
      Complete typography scale configuration
    </ResponseField>

    <ResponseField name="googleFontsUrl" type="string" required>
      Ready-to-use Google Fonts URL
    </ResponseField>
  </Expandable>
</ResponseField>

## Usage Examples

<CodeGroup>
  ```typescript Basic Usage theme={null}
  import { getPairingsByMood } from '@/lib/pairings';

  const minimalPairings = getPairingsByMood('minimal');

  console.log(`Found ${minimalPairings.length} minimal pairings`);
  minimalPairings.forEach(p => {
    console.log(`- ${p.name}: ${p.heading} + ${p.body}`);
  });
  ```

  ```typescript Filter UI Component theme={null}
  import { getPairingsByMood } from '@/lib/pairings';
  import { useState } from 'react';

  function MoodFilter() {
    const [selectedMood, setSelectedMood] = useState('minimal');
    const pairings = getPairingsByMood(selectedMood);
    
    return (
      <div>
        <select 
          value={selectedMood} 
          onChange={(e) => setSelectedMood(e.target.value)}
        >
          <option value="minimal">Minimal</option>
          <option value="professional">Professional</option>
          <option value="playful">Playful</option>
        </select>
        
        <div className="results">
          {pairings.map(pairing => (
            <div key={pairing.name}>
              <h3>{pairing.name}</h3>
              <p>{pairing.description}</p>
            </div>
          ))}
        </div>
      </div>
    );
  }
  ```

  ```typescript Check If Mood Exists theme={null}
  import { getPairingsByMood } from '@/lib/pairings';

  function hasPairingsForMood(mood: string): boolean {
    return getPairingsByMood(mood).length > 0;
  }

  if (hasPairingsForMood('nordic')) {
    console.log('Nordic pairings available');
  } else {
    console.log('No nordic pairings found');
  }
  ```

  ```typescript Get Multiple Moods theme={null}
  import { getPairingsByMood } from '@/lib/pairings';

  function getPairingsByMoods(moods: string[]): PairingData[] {
    const results = new Map();
    
    moods.forEach(mood => {
      const pairings = getPairingsByMood(mood);
      pairings.forEach(p => results.set(p.name, p));
    });
    
    return Array.from(results.values());
  }

  // Get all pairings that are either minimal OR professional
  const versatilePairings = getPairingsByMoods(['minimal', 'professional']);
  console.log(`Found ${versatilePairings.length} versatile pairings`);
  ```

  ```typescript Mood-Based Recommendation theme={null}
  import { getPairingsByMood } from '@/lib/pairings';

  function recommendPairingForProject(
    projectType: 'startup' | 'corporate' | 'creative'
  ): PairingData | null {
    const moodMap = {
      startup: 'minimal',
      corporate: 'professional',
      creative: 'playful'
    };
    
    const mood = moodMap[projectType];
    const pairings = getPairingsByMood(mood);
    
    // Return first matching pairing
    return pairings[0] || null;
  }

  const recommended = recommendPairingForProject('startup');
  if (recommended) {
    console.log(`Recommended: ${recommended.name}`);
  }
  ```

  ```typescript Display Mood Statistics theme={null}
  import { getPairingsByMood, getAllMoods } from '@/lib/pairings';

  function getMoodStatistics() {
    const allMoods = getAllMoods();
    
    return allMoods.map(mood => ({
      mood,
      count: getPairingsByMood(mood).length
    })).sort((a, b) => b.count - a.count);
  }

  const stats = getMoodStatistics();
  stats.forEach(({ mood, count }) => {
    console.log(`${mood}: ${count} pairings`);
  });
  ```
</CodeGroup>

## Example Response

```json theme={null}
[
  {
    "name": "agency",
    "heading": "Schibsted Grotesk",
    "headingCategory": "sans-serif",
    "body": "Karla",
    "bodyCategory": "sans-serif",
    "mono": "Fira Code",
    "mood": ["minimal", "nordic"],
    "useCase": ["agency", "design", "portfolio"],
    "description": "Nordic minimalism meets grotesque warmth. Schibsted Grotesk's Scandinavian clarity in headlines paired with Karla's quirky grotesque personality for body text that feels human.",
    "scale": {
      "h1": {
        "size": "2.25rem",
        "weight": 700,
        "lineHeight": "1.15",
        "letterSpacing": "-0.03em"
      },
      "body": {
        "size": "1rem",
        "lineHeight": "1.6",
        "weight": 400
      }
    },
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700&family=Karla:wght@400;500;600&family=Fira+Code:wght@400;500&display=swap"
  }
]
```

## Notes

<Note>
  **Multiple Moods**: Each pairing can have multiple mood tags. A pairing tagged with `["minimal", "nordic"]` will be returned when searching for either "minimal" or "nordic".
</Note>

<Warning>
  **Case Sensitivity**: Mood matching is case-sensitive. `"Minimal"` will not match `"minimal"`. Always use lowercase mood values as defined in the registry.
</Warning>

<Tip>
  Use the `getAllMoods()` function to get a complete list of available mood tags in the registry.
</Tip>

<Note>
  **Performance**: This function filters the entire pairings array on each call. For frequently accessed mood filters in production, consider caching the results.
</Note>

## Related Functions

* [`getAllPairings`](/api/functions/get-all-pairings) - Get all available pairings
* [`getPairing`](/api/functions/get-pairing) - Get a specific pairing by name
* [`getPairingsByCategory`](/api/functions/get-pairings-by-category) - Filter by font category
* `getAllMoods` - Get all available mood tags (see lib/pairings.ts:47)
