Fonts - Material Tailwind

@material-tailwind/react comes with 2 different font families. One is the default font family and the other is the monospace font family. The default font family is Inter and the monospace font family is Fira Code.


Inter Font Family

Add the following code to the <head> tag of your HTML file.

<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap" rel="stylesheet" />

Stylesheet

Add the following code to your stylesheet.

@import url('https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap');

Next.js Method

You can use next/font to import the Inter font family if you are using Next.js.

On the layout.tsx file add the following code.

import * as React from "react";
import { Inter } from "next/font/google";

const inter = Inter({
weight: ["100", "200", "300", "400", "500", "600", "700", "800", "900"],
subsets: ["latin"],
display: "swap",
});

interface RootLayoutProps {
children: React.ReactNode;
}

export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en" className={inter.className}>
<body>...</body>
</html>
);
}
import * as React from "react";
import { Inter } from "next/font/google";

const inter = Inter({
weight: ["100", "200", "300", "400", "500", "600", "700", "800", "900"],
subsets: ["latin"],
display: "swap",
});

interface RootLayoutProps {
children: React.ReactNode;
}

export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en" className={inter.className}>
<body>...</body>
</html>
);
}

Fira Code Font Family

Add the following code to the <head> tag of your HTML file.

<link href="https://fonts.googleapis.com/css2?family=Fira+Code:[email protected]&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:[email protected]&display=swap" rel="stylesheet">

Stylesheet

Add the following code to your stylesheet.

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:[email protected]&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:[email protected]&display=swap');

Next.js Method

You can use next/font to import the Inter font family if you are using Next.js.

On the layout.tsx file add the following code.

import * as React from "react";
import { Fira_Code } from "next/font/google";

const firaCode = Fira_Code({
weight: ["300", "400", "500", "600", "700"],
subsets: ["latin"],
display: "swap",
});

interface RootLayoutProps {
children: React.ReactNode;
}

export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en" className={firaCode.className}>
<body>...</body>
</html>
);
}
import * as React from "react";
import { Fira_Code } from "next/font/google";

const firaCode = Fira_Code({
weight: ["300", "400", "500", "600", "700"],
subsets: ["latin"],
display: "swap",
});

interface RootLayoutProps {
children: React.ReactNode;
}

export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en" className={firaCode.className}>
<body>...</body>
</html>
);
}