Skip to content

Unable to use custom font from next/font/google #2743

Answered by segunadebayo
allenhartwig asked this question in Q&A
Discussion options

You must be logged in to vote

This sounds like you added the next font directly to the panda config.

Ideally, you should:

  • load the font in the layout file (using a variable)
export const FiraCode = Fira_Code({
  weight: ['400', '500', '700'],
  display: 'swap',
  subsets: ['latin'],
  variable: '--font-fira-code'
})
  • reference the font variable in your panda config
export default defineConfig({
  theme: {
    extend: {
      tokens: {
        fonts: {
          fira: { value: 'var(--font-fira-code), Menlo, monospace' },
        }
      }
    }
  }
})

https://panda-css.com/docs/guides/fonts#update-panda-config

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@allenhartwig
Comment options

@cgatian
Comment options

Answer selected by allenhartwig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants