How to add custom fonts in T3 app

is there a definitive way of doing this I've tried many ways but none of them work. I want to use poppins font from google fonts
16 Replies
barry
barry2y ago
I like the new @next/font thing Adds fonts easily
aditya
aditya2y ago
is it in next 13 or can i use it in my app
barry
barry2y ago
Go look it up It’s it’s own package
aditya
aditya2y ago
ah okay its in next13 ill have to setup layout.tsx is there any other way?
barry
barry2y ago
No you don’t I literally just did it myself, imported the font and used it
barry
barry2y ago
GitHub
GitHub - barrybtw/next13-hero
Contribute to barrybtw/next13-hero development by creating an account on GitHub.
cje
cje2y ago
next/font is cool if you're still on next 12, fontsource is fine
barry
barry2y ago
Why would it not work in v12 though
cje
cje2y ago
never mind i thought it was a new thing anyway managing and loading fonts has historically been kind of a pain if you want it to be great, and next/font seems like the best solution imo you should still spend some time learning about how webfonts work and the different things that can happen depending on the user's browser settings
aditya
aditya2y ago
thanks for reference in the documentation there was layout.tsx so i thought i have to make it
Leonidas
Leonidas2y ago
I recommend you to self host your fonts with linked stylesheets. Online you can find some code gen tools so you simply have to download and extract a zip to your public directory in next and import the css file in it
aditya
aditya2y ago
do i have to add _documents.tsx to use the fonts?
barry
barry2y ago
Just try 🤷 Check docs for next font
aditya
aditya2y ago
was going through your project really cool
Leonidas
Leonidas2y ago
google webfonts helper
A Hassle-Free Way to Self-Host Google Fonts. Get eot, ttf, svg, woff and woff2 files + CSS snippets!
Want results from more Discord servers?
Add your server