stackTables: tables one above the other (gt_stack_tables)
AFC, 2024
| Team | Quarterback | Wins | Losses |
|---|---|---|---|
| KC | Patrick Mahomes | 15 | 2 |
| LAC | Justin Herbert | 11 | 6 |
| DEN | Bo Nix | 10 | 7 |
| LV | Gardner Minshew | 4 | 13 |
| Team | Quarterback | Wins | Losses |
|---|---|---|---|
| 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 { stackTables } from "@sportsdataverse/sdvtables/export";
const spec = defineTable<Standing>()
.columns((c) => [c.text("team"), c.text("qb", { label: "Quarterback" }), c.int("wins"), c.int("losses")])
.theme("pl")
.build();
// one spec used twice: each copy gets its own id, so each keeps its decorations
stackTables(
[
{ spec, rows: STANDINGS.filter((r) => r.division === "West") },
{ spec, rows: STANDINGS.filter((r) => r.division === "East") },
],
{ title: "AFC, 2024", caption: "West above, East below", sourceNote: "Source: nflverse" },
);
Tags: node · table · export · stackTables · nfl. All sdvtables examples.