Comments (5)
You could check out how it's been done on the packages/web cal app
It was recently upgraded to leverage @next/font in this PR if that helps calcom/cal.com#6346
from font.
As far as I can tell though (from here), this was done by downloading the font file (not using the npm package) and putting it in the project? Is this the recommended way to do it?
from font.
i'm curious too if this is the best practice or not :)
from font.
I have no idea about if it is -best practice- or not but seems so going from the nextjs docs, you could also leverage tailwindcss to reuse the local font https://nextjs.org/docs/pages/building-your-application/optimizing/fonts#local-fonts
from font.
My solution to implement the font inside a NextJs app
// src/layout.tsx
const fontCal = localFont({
src: '../assets/fonts/CalSans-SemiBold.woff2',
variable: '--font-cal',
});
export default async function RootLayout({ children }: { children: React.ReactNode }) {
...
return (
<html className="dark" style={{ colorScheme: 'dark' }}>
<head />
<body className={cn('min-h-screen bg-background antialiased', fontCal.variable)}>
<main>{children}</main>
</body>
</html>
);
}
Inside your tailwind.config.ts
import { fontFamily } from 'tailwindcss/defaultTheme';
export default {
...
theme: {
extend: {
fontFamily: {
...
heading: ['var(--font-cal)', ...fontFamily.sans],
},
}
}
Now you can use your font inside your className props
<p className="font-cal">
My font heading
</p>
from font.
Related Issues (5)
- Missing OT feature names HOT 3
- Add to Google Fonts HOT 2
- Plans on weights? HOT 21
- Consider changing repository name HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from font.