Tailwind add custom font

How to add a custom font to tailwind

Choose a font

Fontsource

Bunny.net Fonts (google fonts mirror)

Install font

pnpm add @fontsource/FONT

Add font to your main css file

@import '@fontsource/FONT'; /* or @import url(https://fonts.bunny.net/css?family=FONT:WEIGHT);
/* @tailwind imports here */

Add to tailwind config

module.exports = {
    theme: {
        fontFamily: {
				'FONT': ['FONT-NAME','Type (if available)'],
			},
    }
}

How to use

<h1 class="font-FONT">Hello World</h1>