Next.js Discord

Discord Forum

Multiple font weights

Answered
Satin Angora posted this in #help-forum
Open in Discord
Satin AngoraOP
How can I successfully integrate DM Sans font with various font weights like 100, 200, and 300 into my Next.js project? I've attempted several methods, but encountered issues adding these specific font weights. Any suggestions on how to resolve this problem?
Answered by joulev
upgrade nextjs version to latest should fix it
View full answer

21 Replies

import { DM_Sans } from "next/font/google"
it's a variable font so you don't need to specify font weights, but if you want to you can also specify it from the next/font statement
refer to the documentation for more information
Satin AngoraOP
But it only supports 400,500,600 weights. I tried to add a font weight 100 in the weights array.
But getting error
@joulev
@Satin Angora But getting error
what error?
this works fine for me
const sans = DM_Sans({ subsets: ["latin"], weight: ["100"], variable: "--sans" });
this is definitely 100
Satin AngoraOP
I will share a screenshot
@joulev
@Satin Angora Click to see attachment
what nextjs version are you on?
upgrade nextjs version to latest should fix it
Answer
in the nextjs version you are using, DM Sans data is outdated
Satin AngoraOP
Ook let me try
@Satin Angora Ook let me try
How was it?
Satin AngoraOP
@joulev Thanks
Working perfectly