Next.js Discord

Discord Forum

Acess localFont() array of fonts

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hey guys, I got the following code based on the docs:
const gotham = localFont({
  src: [
    { path: "../fonts/Gotham-Bold.woff2", weight: "400", style: "bold" },
    { path: "../fonts/Gotham-Light.woff2", weight: "300", style: "normal" },
  ],
});

<main className={gotham?.className}>{children}</main>


How do I access the font? Right now it seems it just adds one font class. Generally speaking, how can I use the fonts in a array of local font objects? Any literature, example, repo or workaround how to actually use and call the fonts would be much appricated!

0 Replies