Skip to content
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

Add Font instructions when adding to an existing project #69

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions apps/www/content/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,49 @@ module.exports = {
}
```

### Fonts

To add a font to your project you have to install [@nextjs/font](https://nextjs.org/docs/basic-features/font-optimization) and add the following to your `next.config.js`:

```js
const config = {
reactStrictMode: true,
experimental: {
fontLoaders: [
{
loader: "@next/font/google",
options: { subsets: ["latin"] },
},
],
},
}
```

Then declare the CSS variable in your `\_app.tsx`

```ts
import { Inter as FontSans } from "@next/font/google"

const fontSans = FontSans({
subsets: ["latin"],
variable: "--font-sans",
display: "swap",
})

export default function App({ Component, pageProps }: AppProps) {
return (
<>
<style jsx global>{`
:root {
--font-sans: ${fontSans.style.fontFamily};
}
}`}</style>
<Component {...pageProps} />
</>
)
}
```

### Icons

I use icons from [Lucide](https://lucide.dev). You can use any icon library you want.
Expand Down