renderHTMLAsync: prepare and render in one call
| Team | QB | Wins | Losses | |
|---|---|---|---|---|
KC | ![]() | Patrick Mahomes | 15 | 2 |
LAC | ![]() | Justin Herbert | 11 | 6 |
DEN | ![]() | Bo Nix | 10 | 7 |
LV | ![]() | Gardner Minshew | 4 | 13 |
BUF | ![]() | Josh Allen | 13 | 4 |
MIA | ![]() | Tua Tagovailoa | 8 | 9 |
NYJ | ![]() | Aaron Rodgers | 5 | 12 |
NE | ![]() | Drake Maye | 4 | 13 |
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";
// renderHTMLAsync(spec, rows) is await prepare(spec) then renderHTML(spec, rows): use it where you can await.
const spec = defineTable<Standing>()
.columns((c) => [
c.logo("team", { league: "nfl", includeName: true }),
c.headshot("qb_espn_id", { league: "nfl", label: "QB" }),
c.text("qb", { label: "" }),
c.int("wins"),
c.int("losses"),
])
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);
Tags: table · renderHTMLAsync · prepare · nfl. All sdvtables examples.
KC
LAC
DEN
LV
BUF
MIA
NYJ
NE