Installation
This guide covers everything you need to know about installing and setting up Fonttrio in your project.Requirements
Before installing Fonttrio, ensure your project meets these requirements:Next.js 14+
App Router required for
next/font supportshadcn/ui
CLI must be installed and configured
Tailwind CSS
Required for utility classes
Fonttrio uses the shadcn/ui registry system, which requires the shadcn CLI to be installed in your project.
Prerequisites Setup
If you’re starting a new project, follow these steps:Create a Next.js project
Create a new Next.js 14+ project with the App Router:When prompted, select:
- ✅ TypeScript
- ✅ Tailwind CSS
- ✅ App Router
Initialize shadcn/ui
Install and configure shadcn/ui in your project:This will:
- Install required dependencies
- Create
components.jsonconfiguration - Set up your
components/uidirectory - Configure your
tailwind.configandglobals.css
Installing a Font Pairing
Browse available pairings
Visit fonttrio.xyz to browse all 49 curated pairings. Each pairing page includes:
- Live preview with actual fonts
- Typography scale visualization
- Interactive type tester
- Context previews (blog, landing, docs)
- One-click copy install command
Copy the install command
Each pairing has a unique registry URL. The install command follows this pattern:For example, to install the Editorial pairing:
What gets installed
The shadcn CLI will:
- Download font configurations from the Fonttrio registry
- Install three fonts (heading, body, mono) via
next/font/google - Add CSS variables to your
app/globals.css: - Apply typography scale with optimized sizing:
- Configure font loading in your root layout
Registry Structure
Each pairing is distributed as a JSON registry item:Using Fonts in Your App
After installation, fonts are available throughout your project:Automatic HTML Element Styling
The typography scale automatically styles HTML elements:Using CSS Variables Directly
For custom components, use the CSS variables with Tailwind:In Tailwind Config
You can also extend your Tailwind config to create utility classes:Installing Multiple Pairings
You can install multiple pairings in the same project:Customizing Typography Scale
You can customize the typography scale by editingglobals.css:
Troubleshooting
Fonts not loading
Fonts not loading
Symptom: Fonts don’t appear after installation.Solutions:
- Clear your browser cache and hard refresh (Cmd/Ctrl + Shift + R)
- Restart your Next.js dev server
- Check that CSS variables are present in
globals.css - Verify
next/fontis working: - Check browser console for font loading errors
CSS variables not found
CSS variables not found
Symptom: Console shows “CSS variable not found” errors.Solutions:
- Verify the pairing was installed:
- Ensure
globals.cssis imported in your root layout: - Check CSS variable syntax - should use
var(--font-heading)not--font-heading
Typography scale not applying
Typography scale not applying
Symptom: HTML elements don’t have the expected styling.Solutions:
- Check CSS specificity - your custom styles may be overriding Fonttrio
- Ensure no other CSS is resetting h1-h6 styles
- Verify the typography scale CSS is present after the variables in
globals.css - Try using
!importanttemporarily to diagnose specificity issues
shadcn CLI errors
shadcn CLI errors
Symptom:
shadcn add command fails.Solutions:- Verify shadcn is initialized:
- Update to latest shadcn version:
- Check internet connection - registry must be reachable
- Try with full URL including
.jsonextension
Font weights look wrong
Font weights look wrong
Symptom: Fonts appear too bold or too light.Solutions:
- Check which font weights are loaded in the registry JSON
- Google Fonts may not include all weights for every font
- Customize weight in your CSS:
- Some fonts have optical size variants - check if that’s enabled
Performance issues
Performance issues
Symptom: Slow page loads or layout shift.Solutions:
- Fonttrio uses
next/fontwhich includes automatic optimization - Fonts are loaded from Google Fonts CDN with optimal caching
- Reduce number of font weights if performance is critical
- Use
font-display: swap(default in next/font) - Consider font subsetting for non-Latin characters
Best Practices
Font Loading
- Let
next/fonthandle optimization - Don’t manually load Google Fonts
- Keep font weights minimal (2-3 max)
- Use variable fonts when available
CSS Variables
- Use the provided variables consistently
- Don’t hardcode font family names
- Extend in Tailwind config for convenience
- Document any customizations
Typography Scale
- Maintain consistent scale ratios
- Test at different viewport sizes
- Use relative units (rem) for accessibility
- Keep line heights readable (1.5-1.65 for body)
Customization
- Start with defaults, then customize
- Test changes across all components
- Document your scale in design system
- Consider dark mode contrast
Next Steps
Quickstart
Get started in under 2 minutes
Browse Pairings
Explore all 49 curated pairings
Examples
See real-world usage examples