fonttrio

repository·main·Indexed 19 days ago

https://github.com/kapishdima/fonttrio

A collection of curated font pairings (heading, body, and monospace) designed for shadcn/ui projects. It enables developers to install professional typography systems via the shadcn CLI, automatically configuring next/font and CSS variables like --font-heading, --font-body, and --font-mono. The library includes a registry of pairings across categories such as Editorial, Clean, Bold, Corporate, and Creative, as well as an MCP server for AI-driven font discovery and installation.

Tokens
9.5K
Snippets
25
Records
43
Agent score
65%

What's inside fonttrio

  1. Use Fonttrio MCP server to improve typography

    main

    When performing a typography audit, if the Fonttrio MCP (Model Context Protocol) server is available, you can automate the improvement process using the following tools:

    • search_pairings: Find a font pairing that matches your project's specific mood or use case.
    • preview_pairing: View the specific details and characteristics of a recommended pairing.
    • install_pairing: Automatically install the selected pairing into your project.
  2. How Fonttrio works

    main

    Fonttrio leverages the shadcn/ui registry system to automate typography setup. The installation process performs the following steps:

    1. Configures fonts in your Next.js application using next/font.
    2. Sets up CSS custom properties (variables) in your globals.css.
    3. Applies a typography scale via CSS.
    4. Makes the font variables immediately available for use across all components.
  3. Improve typography using Fonttrio

    main

    Once a typography audit is complete, you can improve the project's typography using Fonttrio.

    Using the Fonttrio MCP Server

    If the Fonttrio MCP server is available, you can automate the improvement process:

    1. Use search_pairings to find a pairing that matches the project's mood or use case.
    2. Use preview_pairing to view the details of the recommended pairing.
    3. Use install_pairing to apply the pairing to the project.

    Manual Installation

    If the MCP server is not available, visit https://www.fonttrio.xyz to find a suitable pairing. You can install a pairing manually using the following command format:

    bunx shadcn@latest add https://www.fonttrio.xyz/r/{pairing-name}.json
  4. Use Fonttrio CSS variables in your project

    main

    Once a pairing is installed, Fonttrio automatically configures CSS variables in your globals.css. You can use these variables to apply the curated typography to your elements or components.

    /* Available CSS variables */
    --font-heading
    --font-body
    --font-mono
    
    /* Example usage */
    h1 {
      font-family: var(--font-heading);
      font-size: 2.25rem;
      line-height: 1.15;
      letter-spacing: -0.03em;
      font-weight: 700;
    }
    
    body, p {
      font-family: var(--font-body);
      line-height: 1.6;
    }
    
    code, pre {
      font-family: var(--font-mono);
    }
  5. Install a Fonttrio pairing

    main

    You can add any Fonttrio font pairing to your shadcn/ui project using the shadcn CLI. Replace editorial in the command below with the name of the pairing you wish to install (e.g., minimal, impact, corporate).

    npx shadcn@latest add @fonttrio/editorial
  6. Audit typography in a web project

    main

    To perform a typography audit, follow these steps to analyze the project's current state and identify potential issues:

    1. Locate Typography Configuration

    Search for font declarations and imports in:

    • CSS files (*.css, *.scss, globals.css)
    • Tailwind configurations (tailwind.config.*)
    • Font imports (next/font, @import url(...), @font-face)
    • Typography CSS variables (e.g., --font-*)
    • shadcn/ui theme configurations

    2. Analyze the Current State

    Evaluate the following metrics:

    • Font Count: How many fonts are loaded (heading, body, mono)?
    • Typography Scale: Is there a consistent scale for headings (h1-h6)?
    • Consistency: Check font weights, line heights, and letter spacing.
    • Loading Strategy: Verify the font-display strategy (e.g., swap, block, optional).

    3. Identify Common Issues

    Look for these specific problems:

    • Missing Categories: Lack of dedicated heading, body, or mono fonts.
    • Inconsistency: Varying font sizes across different components.
    • Performance: Loading too many different font files.
    • Implementation Errors: Missing font-display strategies or using hardcoded font stacks instead of CSS variables.
    • Accessibility: Body text that is too small or insufficient contrast in font weights.
  7. Install a font pairing manually

    main

    If you are not using the Fonttrio MCP server, you can install a font pairing manually using bunx. Use the following command format, replacing {pairing-name} with the specific name of the pairing you wish to install:

    bunx shadcn@latest add https://www.fonttrio.xyz/r/{pairing-name}.json

    bunx shadcn@latest add https://www.fonttrio.xyz/r/{pairing-name}.json
  8. How to install fonts and pairings via MCP

    main

    When using the install_pairing or install_font tools, the server does not execute the installation itself. Instead, it returns a shell command prefixed with [ACTION REQUIRED].

    Crucial Step: The agent/client receiving the response must immediately execute the returned shell command using a terminal or bash tool to complete the installation in the local project environment.