Skip to main content

iconSet: every icon, picked per row with iconRef

NameIcon
circle0
square1
diamond2
star3
triangle-up4
triangle-down5
arrow-up6
arrow-down7
arrow-right8
check9
xmark10
minus11
plus12
heart13
import { defineTable } from "@sportsdataverse/sdvtables";
import { ICON_NAMES, renderHTMLAsync } from "@sportsdataverse/sdvtables/html";

// ICON_NAMES lists the inline-SVG icons iconSet and iconAssign draw. iconRef reads each row's icon from a column, and
// iconPosition "over" shows the icon alone.
const icons = ICON_NAMES.map((name, i) => ({ name, i }));
const spec = defineTable<(typeof icons)[number]>()
.columns((c) => [
c.text("name", { label: "Name" }),
c.iconSet("i", {
label: "Icon",
iconRef: "name",
iconPosition: "over",
colors: ["#15607A"],
iconSize: 20,
}),
])
.build();
await renderHTMLAsync(spec, icons);

Tags: formatter · iconSet · icon_sets · reactablefmtr · ICON_NAMES. All sdvtables examples.