Skip to content

[v4] NextJS font variable not applying inside tailwind #13410

Discussion options

You must be logged in to vote

Hey! Don't forget to follow the instructions in the Next docs for setting those font variables:

https://nextjs.org/docs/pages/building-your-application/optimizing/fonts#with-tailwind-css

Here's a working version of your layout.tsx file:

import type { Metadata } from "next";
import { Montserrat, Poppins, PT_Serif } from "next/font/google";
import "./globals.css";

const montserrat = Montserrat({
  subsets: ["latin"],
  variable: "--font-montserrat",
});

const poppins = Poppins({
  subsets: ["latin"],
  weight: ["500"],
  variable: "--font-poppins",
});

const ptSerif = PT_Serif({
  subsets: ["latin"],
  weight: ["400"],
});

export const metadata: Metadata = {
  title: "Create Next App",
  

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chandan-jal-evolution
Comment options

Answer selected by chandan-jal-evolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #13409 on March 30, 2024 13:24.