Understanding the Typography Scale
Each Fonttrio pairing includes a complete typography scale defined in CSS:globals.css file.
Customizing the Scale
You can customize any part of the typography scale by editingglobals.css:
Adjusting Font Sizes
Override specific heading sizes:app/globals.css
Adjusting Font Weights
Change weights for different emphasis:app/globals.css
Adjusting Line Heights
Modify line heights for better readability:app/globals.css
Adjusting Letter Spacing
Fine-tune letter spacing (tracking):app/globals.css
Changes to
globals.css affect all instances of these elements throughout your app. For component-specific overrides, use Tailwind classes or CSS modules.Using Tailwind Classes for Overrides
For component-specific customizations, use Tailwind utility classes:Override Font Size
Override Font Weight
Override Line Height
Override Letter Spacing
Combining Overrides
Creating Responsive Typography
Use Tailwind’s responsive prefixes to create adaptive typography:app/globals.css
Customizing CSS Variables
You can override the font family variables to create custom combinations:Swap Fonts Within a Pairing
app/globals.css
Create Dark Mode Font Variations
app/globals.css
Creating Custom Font Pairings
You can mix and match individual fonts from different pairings:1
Install Multiple Pairings
Install pairings that contain the fonts you want to mix.
2
Create Custom Variables
Override the CSS variables to create your custom combination.
app/globals.css
3
Apply to Layout
Import the fonts in your layout.
app/layout.tsx
4
Customize the Scale
Adjust typography scale to match your custom pairing.
app/globals.css
When creating custom pairings, test thoroughly to ensure the fonts complement each other. Consider contrast (serif vs sans), weight, and x-height compatibility.
Using the Typography Customizer (Preview Site)
The Fonttrio preview site includes an interactive typography customizer:Advanced Customization Techniques
Creating Context-Specific Scales
Define different scales for different sections:app/globals.css
Using CSS Custom Properties for Dynamic Scales
Create adjustable scales with CSS variables:app/globals.css
Extending Tailwind Config
Add custom font sizes to Tailwind:tailwind.config.js
Best Practices
1
Start with Defaults
Use the pairing’s default scale first. Only customize after seeing how it works in your actual content.
2
Maintain Hierarchy
Ensure h1 is always larger than h2, h2 larger than h3, etc. Keep a clear visual hierarchy.
3
Test Across Viewports
Verify your customizations work on mobile, tablet, and desktop. Use responsive utilities or clamp().
4
Consider Line Length
Adjust line height based on line length. Longer lines need more line height (1.6-1.8), shorter lines can be tighter (1.4-1.5).
5
Test with Real Content
Don’t just test with “Lorem ipsum”. Use actual headings and paragraphs from your content.
6
Document Your Changes
Add comments in
globals.css explaining why you customized specific values.Common Customization Patterns
Marketing Landing Pages
Blog and Editorial
Documentation Sites
SaaS Dashboards
Next Steps
Mix Multiple Pairings
Learn how to install and switch between multiple font pairings.
Use with shadcn/ui
Apply your custom typography to shadcn/ui components.