How to use the new Astro 6 Fonts system in starlight #3763
-
|
i want to use the new astro6 font syste for a starlight project |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Using custom fonts with Astro 6 in Starlight requires a bit of setup at the moment.
At this point, your project will be using the "Press Start 2P" font:
You can find a complete example here: https://starlight-examples.netlify.app/examples/custom-fonts/ Maybe there is a future where we provide some native Starlight options to make this process easier, and avoid all this boilerplate, but for now, this setup should work just fine! |
Beta Was this translation helpful? Give feedback.

Using custom fonts with Astro 6 in Starlight requires a bit of setup at the moment.
First, you would need to configure a custom font as documented in Astro Docs, for example using the "Press Start 2P" font from Fontsource:
Then, you would need to add the font to Starlight page head with an identifying CSS variable. This can be achieved by using Starlight component overrides which also allows re-using built-in Starlight components: