fontFace
A @font-face rule for a web font.
A @font-face rule for a web font. font-display defaults to swap.
Import#
ts
import { fontFace } from "@shadow-js/dusk";
Signature#
ts
function fontFace(options: FontFaceOptions): string
Parameters#
| Name | Description |
|---|---|
options |
The family, sources and descriptors. |
Returns#
The CSS rule.
Throws#
- TypeError for a name or URL that could break out of the CSS, an unknown format or display value, or no sources.
Examples#
ts
fontFace({ family: "Inter", src: [{ url: "/fonts/inter.woff2", format: "woff2" }], weight: "100 900" });