Skip to content

Theming

The table reads the standard shadcn tokens, and shadcn-svelte-headless-table/styles.css defines light and dark defaults:

VariableUsed for
--cardThe table background
--card-foregroundText
--border, --inputDividers and the borders of inputs
--accentHovered rows and menu items
--primaryFocus rings, checked boxes, the loading bar
--muted-foregroundSecondary text

Define them on :root, on .dark, or on any element to theme just the tables inside it:

:root {
--primary: oklch(0.55 0.2 260);
--card: oklch(1 0 0);
}
.dark {
--primary: oklch(0.75 0.12 250);
--card: oklch(0.205 0 0);
}

classes adds class names to the parts: container, toolbar, bottomToolbar, row and cell. class goes on the outer element.

Pass any of the bundled locales, or your own strings, with localization:

import { MRT_Localization_ES } from 'shadcn-svelte-headless-table/locales/es';
<ShadcnHeadlessTable {columns} {data} localization={MRT_Localization_ES} />