You can use Nuxt Fonts with pure CSS by adding font-family
declarations to your CSS:
div {
font-family: 'Inter', sans-serif;
}
font-family
declaration. Subsequent fonts in the list will be used to generate metrics for font fallbacks.You can use Nuxt Fonts with Tailwind CSS by setting fontFamily
in your configuration file:
export default {
theme: {
extend: {
fontFamily: {
custom: ['Inter'],
},
},
},
}
TailwindCSS v4 brings a brand new way for configuration. In v4 if you want to specify a font, you would use a CSS variable:
@theme {
--font-display: "Inter", "sans-serif";
}
As it uses CSS variables, you should enable the Nuxt Fonts processCSSVariables
experimental feature to enable support for processing CSS variables for font family names:
export default defineNuxtConfig({
modules: ['@nuxt/fonts'],
fonts: {
experimental: {
processCSSVariables: true,
},
}
})
processCSSVariables
is still an experimental feature and may have a performance impact.You can use Nuxt Fonts with UnoCSS by setting fontFamily
in your configuration file:
import { defineConfig } from 'unocss'
export default defineConfig({
theme: {
fontFamily: {
inter: 'Inter',
},
},
})