Skip to main content

tooltip: a cell's value on hover

AFC, 2024: hover a bar
TeamNet EPA/play
KC
0.063
LAC
0.101
DEN
0.108
LV
-0.146
BUF
0.190
MIA
-0.019
NYJ
-0.045
NE
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";

// tooltip: true on any column writes the cell's value as its title attribute, which the browser shows on hover: here
// the exact net EPA behind each bar. No tooltip library is loaded.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.dataBar("net_epa", {
label: "Net EPA/play",
textPosition: "none",
numberFormat: { digits: 3 },
tooltip: true,
}),
])
.title("AFC, 2024: hover a bar")
.build();
await renderHTMLAsync(spec, STANDINGS);

Tags: formatter · tooltip · reactablefmtr. All sdvtables examples.