Guides
Tint Tokens Guide
The four CSS variables Shadcn Table reads for striped, hovered and selected rows and the pinned edge shadow, and how to override them
Every tint the table paints comes from four CSS variables. The table root declares them with Tailwind utilities, each mixed from your shadcn/ui theme variables, so the table follows your theme in light and dark mode without any stylesheet of its own. A library install never touches your globals.css.
Example
Relevant Table Options
| Prop Name | Type | Description |
|---|---|---|
| stTableLayoutProps | PaperProps | ({ table }} => PaperProps |
The Four Tokens
| Variable | Used for | Light default | Dark default |
|---|---|---|---|
--st-stripe | alternating row colors | --muted 70% mixed with --background | --muted 25% mixed with --background |
--st-hover | the hovered row | --border 50% mixed with --background | --muted 55% mixed with --background |
--st-selected | selected rows | --primary 20% mixed with --background | the same |
--st-edge-shadow | the shadow of the inner pinned column edges | --background 0.08 darker in lightness | the same |
Every default is an opaque mix with --background, so pinned cells can use the same color and never turn see-through while the table scrolls under them. Where the browser has no relative color syntax, --st-edge-shadow falls back to --border.
The Order Rule
The defaults keep one order, and overrides should too: the hover tint replaces the stripe on a hovered row and reads stronger than it, and selection reads stronger than hover. The header has no tint (it stays --background), and grid lines stay --border.
Override the Tokens
Set a variable on the table root through stTableLayoutProps.className, with a Tailwind arbitrary property and a dark: twin where the dark value differs. The table merges your classes over its own, so your value replaces the default for that variable (and the dark: twin for dark mode).
const table = useShadcnTable({
columns,
data,
stTableLayoutProps: {
className:
'[--st-hover:color-mix(in_srgb,var(--primary)_8%,var(--background))] dark:[--st-hover:color-mix(in_srgb,var(--primary)_15%,var(--background))]',
},
});Variables declared on an ancestor do not reach the cells, because the table root declares its own values in between. To restyle many tables at once, give them a shared stTableLayoutProps (for example through a shared defaults object, see the Best Practices Guide), or change the theme variables they are mixed from (--muted, --border, --primary, --background) on an ancestor.
There is no table option for the tokens and no stylesheet to import: every style of the table is a Tailwind utility on a component element, and the tokens follow the same rule.
Tint Tokens Example
Select a few rows and hover them to see --st-selected and --st-hover. Turn on Alternating row colors in the view settings panel for --st-stripe.
View Extra Storybook Examples