Skip to main content

colorResults: a row filled by its result

AFC, 2024: final regular-season game
TeamQbLast game
KCPatrick MahomesL
LACJustin HerbertW
DENBo NixW
LVGardner MinshewL
BUFJosh AllenL
MIATua TagovailoaL
NYJAaron RodgersW
NEDrake MayeW
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";

// The cell holds W or L; the whole row takes the win or loss fill.
const spec = defineTable<Standing>()
.columns((c) => [c.text("team"), c.text("qb"), c.colorResults("result_last", { label: "Last game" })])
.title("AFC, 2024: final regular-season game")
.build();
await renderHTMLAsync(spec, STANDINGS);

Tags: kind · colorResults · gt_color_results. All sdvtables examples.