How is font being applied here?
Unanswered
Genio posted this in #help-forum
GenioOP
I am following the admin-dashboard tutorial from the next.js website. They are adding a font but i dont understand what they did
This is the font.tsx
import '@/app/ui/global.css';
import { inter } from '@/app/ui/fonts';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={`${inter.className} antialiased`}>{children}</body> //the class name part
</html>
);
}This is the font.tsx
import {Inter } from 'next/font/google'
export const inter = Inter({ subsets: ['latin'] })2 Replies
GenioOP
bump
@Genio I am following the admin-dashboard tutorial from the next.js website. They are adding a font but i dont understand what they did
tsx
import '@/app/ui/global.css';
import { inter } from '@/app/ui/fonts';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={`${inter.className} antialiased`}>{children}</body> //the class name part
</html>
);
}
This is the font.tsx
tsx
import {Inter } from 'next/font/google'
export const inter = Inter({ subsets: ['latin'] })
Asiatic Lion
They're importing a font (Inter) from Google Fonts and then attach a css class to the
Inspect
body element.Inspect
body tag in your browser, look at css classes.