In this guide, I’ll walk through the steps to add Adobe Fonts (Typekit) to your Next.js project styled with Tailwind CSS. Adobe Fonts offers a wide range of high-quality fonts that can enhance your web project. I’m already subscribed to Adobe Creative Cloud, which means I can access Access to the full Adobe Fonts library without any extra charge.
<link>
tag or the project-specific JavaScript snippet provided for embedding the fonts.For this I’m just going to run the following command: npx create-next-app@latest and accept the default settings.
Using the <link>
Tag (Recommended for Performance):
layout.tsx
file in the app/
directory (this may differ if you decided not to accept the default settings when creating your app)<link>
tag, like this:import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<head>
<link rel='stylesheet' href='https://use.typekit.net/lzo5owa.css' />
</head>
<body
className='antialiased bg-zinc-950 text-zinc-100'
>
<h1 className="font-sans font-bold text-3xl">Testing</h1>
{children}
</body>
</html>
);
}
layout.tsx
After adding the Adobe Fonts to your project, you need to use them in your Tailwind CSS configuration.
tailwind.config.ts
.fontFamily
property in the theme:import type { Config } from "tailwindcss";
export default {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
},
fontFamily: {
sans: ['neulis-sans', 'sans-serif'],
},
},
},
plugins: [],
} satisfies Config;
tailwind.config.ts
3. Extend the fontFamily
property in the theme:
<h1 className="text-3xl font-sans">Hello, World!</h1>