-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cant load custom fonts with nextJS #30185
Comments
This should help - https://stackoverflow.com/questions/60134693/why-is-my-local-font-not-being-applied-with-emotion-global-styling You can define the font face using |
I tried defining them into the global css file and then had MUI try to access them inside |
I figured out the problem, I was defining the formats of the font incorrectly, which was why they weren't loading. For others here's how this'll work in your global css define the fonts
and then refer them inside your theme object as how you do for regular fonts Thanks |
@Altair2169 one note though, there is no such thing as |
@Altair2169 thx for posting your solution, it works like charm 🚀 |
Duplicates
Latest version
Current behavior 😯
I have been trying to load custom fonts in MUI for my nextJS project. But it errors out. According to the docs we need a loader for it parse custom fonts but I haven't been able to find any information related to that. How should I configure Next and MUI to load the fonts?
The only workaround I have been able to find is to define the font family through a global css file. But then the fonts don't work inside components.
Here's my code for
theme.ts
and here's the error I'm getting during the process
Expected behavior 🤔
The custom fonts should be loaded
Steps to reproduce 🕹
Steps:
theme.ts
Context 🔦
No response
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: