Skip to main content

fonts: false, and loading the fonts yourself

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Spline+Sans+Mono:wght@500&amp;family=Work+Sans:wght@500;650&amp;display=swap">

AFC, 2024
TeamWinsLosses
152
116
107
413
134
89
512
413
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable, resolveTheme } from "@sportsdataverse/sdvtables";
import { fontsLink, prepare, renderHTML } from "@sportsdataverse/sdvtables/html";

const spec = defineTable<Standing>()
.columns((c) => [c.logo("team", { league: "nfl", includeName: true }), c.int("wins"), c.int("losses")])
.theme("athletic")
.title("AFC, 2024")
.build();
await prepare(spec);
// Every table starts with a Google Fonts <link> for its theme. fonts: false leaves it out; the page loads them
// once instead, e.g. with this <link> in its <head>:
const head = fontsLink(resolveTheme(spec.theme).fonts);
const escaped = head.replace(/&/g, "&amp;").replace(/</g, "&lt;");
`<p><code>${escaped}</code></p>\n${renderHTML(spec, STANDINGS, { fonts: false })}`;

Tags: table · renderHTML · fonts · fontsLink · nfl. All sdvtables examples.