Skip to main content

highlight: cells that match a predicate

AFC, 2024: 11 or more wins
TeamWinsLosses
KC152
LAC116
DEN107
LV413
BUF134
MIA89
NYJ512
NE413
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";

// The rule is data (a predicate), not a function, so the spec stays serializable.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.highlight("wins", { key: "wins", op: ">=", value: 11 }, { label: "Wins", bold: true }),
c.int("losses"),
])
.title("AFC, 2024: 11 or more wins")
.build();
await renderHTMLAsync(spec, STANDINGS);

Tags: kind · highlight · gt_highlight_cells · predicate. All sdvtables examples.