Next.js Discord

Discord Forum

next/font/google storybook

Answered
Polar bear posted this in #help-forum
Open in Discord
Polar bearOP
Hello,

I am using the next/font/google like this in pages router:

export const inter = Inter({ subsets: ['latin'], variable: '--font-inter' });

function App() {
  return <main className={`${inter.variable} font-sans`}>...</main>;
}

And in my tailwind config like:
fontFamily: {
  sans: ['var(--font-inter)', ...fontFamily.sans]
},

This works when I run it, however, when I open storybook, it does not import the font.

I have googled it and storybook says that the next/font/google is supported without having to put changes, however, that does not work for me.
Answered by Polar bear
Fixed it by adding a decorator to preview.tsx in .storybook
View full answer

1 Reply

Polar bearOP
Fixed it by adding a decorator to preview.tsx in .storybook
Answer