Skip to main content
Customize your app’s typography with custom fonts.

Google Fonts

The easiest way to add fonts:

Implementation

Add the Google Fonts <link> tags in the <head> of your base layout:

Using in Tailwind

Map the fonts to Tailwind font families so you can use utility classes:
Then use in components:

Modern & Clean

Professional

Creative

Tech/Startup

Local Fonts

For fonts not on Google Fonts:

Add Font Files

Place in public/fonts/:

Configure

Declare the font with @font-face in your global stylesheet, pointing at the files in public/ (served from the site root):
Then use class="font-brand" on your headings or body text.

Font Weights

Common weight names:

Loading Specific Weights

Only load what you need for better performance. Request just those weights in your Google Fonts <link> URL:

Font Performance

Optimization Tips

  1. Load only needed weights - Don’t load all weights
  2. Limit font families - 2-3 max
  3. Use font-display: swap - Shows fallback while loading
  4. Subset fonts - Only latin if that’s all you need

Reduce Layout Shift

To keep fonts fast and avoid layout shift:
  • Self-host the .woff2 files in public/fonts/ (no external request) when you want zero third-party calls
  • Preconnect / preload the font in your base layout’s <head>
  • Use font-display: swap so text shows in a fallback while the font loads
  • Set a matching fallback font family so the swap is barely noticeable

Typography Scale

Consistent Sizing

Use Tailwind’s typography scale:

Custom Scale

Line Height & Spacing

Line Height

Letter Spacing

Common Font Tasks

Change All Fonts

Consistent Typography

Brand Font

Font Fallbacks

Always specify fallbacks in your Tailwind theme:

Variable Fonts

Modern fonts with adjustable properties. Load the single variable .woff2 and declare a weight range with @font-face:
Benefits:
  • Smaller file size
  • All weights in one file
  • Smooth weight transitions

Troubleshooting

  • Check font name spelling (must match the @font-face/<link> exactly)
  • Verify the weight exists for that font
  • Check the browser console for errors
  • Ensure the <link> is in the base layout <head>, or the font file exists in public/fonts/
  • Make sure font-display: swap is set (in the Google Fonts URL or your @font-face)
  • Preconnect/preload the font in the base layout <head>
  • Set a matching fallback font family so the swap is barely noticeable
  • Verify you loaded the correct weight
  • Check CSS isn’t overriding font settings
  • Ensure the Tailwind font family (e.g. font-heading) is applied to your element

Styling Best Practices

More design tips