@ds-starter/fonts is the part of the Design System Starter (DSS) Template
The package is created for demo purposes and is not intended for production usage
See it in action:
Fonts package is optional and created for convenient fonts management.
In most cases it makes sense to setup custom loading, you will need to take care of fonts delivery.
However for quick hacking or dev-oriented projects base64-encoded files can work just fine.
npm i @ds-starter/fonts
import '@ds-starter/fonts/css/fonts.css';
Note, this component is supposed to be used on server side.
import { GoogleFonts } from '@ds-starter/fonts';
// ...
<html>
<head>
<GoogleFonts weights={[400, 700]} />
</head>
</html>
Interface
interface FontsProps {
// font-weights
weights: number[] | string[];
// font-display method, 'swap' by default
display?: 'swap' | 'auto' | 'block' | 'fallback' | 'optional';
// use of preconnect, true by default
preconnect?: boolean;
}
To build the package run the standard command:
pnpm build
Lint:
pnpm lint
Format:
pnpm format
Note that local commands don't consider workspace dependencies - make sure to build everything in advance.
Alternatively, use globalturbo
commands (i.e.turbo dev
).
Explore turbo docs for more information.
- Fonts by Google Fonts
- Build is powered by Vite
- Fonts Loading Strategies by Zach Leatherman