colorPills: a pill in each team's colour
| Team | Wins |
|---|---|
| KC | 15 |
| LAC | 11 |
| DEN | 10 |
| LV | 4 |
| BUF | 13 |
| MIA | 8 |
| NYJ | 5 |
| NE | 4 |
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";
// reactablefmtr pill_buttons(color_ref): team + league (or colorRef, a colour column) give each row its own pill
// colour; the text turns black or white to stay readable.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.colorPills("wins", { label: "Wins", team: "team", league: "nfl", domain: [0, 17], digits: 0 }),
])
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);
Tags: formatter · colorPills · pill_buttons · reactablefmtr · nfl. All sdvtables examples.