Density + theming
View sourceThree density modes for different work surfaces, plus a fully tokenised theme that follows the host app's light/dark scheme. No CSS overrides needed for the common cases.
Try this
Toggle density and theme above the grid.
- compact — for power users staring at the grid all day. Tight row height, small font.
- normal — the default. Balanced for most ERP screens.
- comfortable — looser spacing, larger touch targets, useful on a tablet or for executive-summary screens.
- Light / dark / system — flips the host app theme. The grid follows automatically.
How density works
The density prop swaps a CSS data attribute on the grid root. CSS variables in @bc-grid/theming remap row height, font size, padding, and the action-column hit area. Animations run through the same FLIP layer so density changes look smooth, not jarring.
Theming
- No CSS overrides.The grid reads from the host app's shadcn theme tokens —
--background,--foreground,--border,--primary— and adds a few of its own (--bc-grid-row-hover,--bc-grid-pinned-shadow). Override those if you want a fully custom palette. - Light / dark.Driven by the parent app's
.darkclass on<html>. No grid-side toggle — flip the host theme and the grid follows. - Custom themes. Define new
--bc-grid-*variables in any selector that wraps the grid; they cascade normally.
Wiring it up
Import @bc-grid/theming/styles.css once at the root of your global stylesheet. Tailwind v4's @source directive makes sure classes used inside bc-grid's sources are compiled into your app's CSS bundle. See apps/bc-grid-demo/app/globals.css for a copy-pasteable setup.