Skip to content

CSS tokens ​

All styling is driven by custom properties named --dg-*. They are defined on the grid root .dg (and on .dg-portal, the fallback root panels use when the browser has no Popover API), never on :root, and without @layer. Pixel values below assume the default --dg-rem of 16 px.

css
/* rebrand every grid on the page */
:root { --dg-accent: #0f766e; }

/* one grid: set tokens on its root */
#agents-page .dg { --dg-head-bg: #eef2ff; --dg-row-h: 2rem; }
  • Input tokens (--dg-accent, --dg-rem) are only read, never defined, so they inherit: set them on :root, body, any wrapper or .dg.
  • All other tokens are defined on .dg: override them with a selector that matches the root and is more specific than .dg (.my-page .dg). The data-size and data-density variants use .dg[data-…], so overriding a size or density token needs at least that specificity.
  • Tokens starting with --dg-_ (underscore) are private row-state variables: don't set or read them.

See Theming for the how-to.

Input tokens ​

TokenDefaultMeaning
--dg-accent#3d63dd (read as var(--dg-accent, #3d63dd))Brand color. Every accent token below derives from it, with legibility guarded in modern browsers.
--dg-rem1remBase unit; every size, space and radius is a multiple of it. If the host shrinks html { font-size } for its own layout, pin it: body { --dg-rem: 16px; }.

Palette ​

Light values are the static defaults; dark values apply under a dark color-scheme in browsers with light-dark().

TokenLightDarkMeaning
--dg-bg#ffffff#17191dCell and body background.
--dg-fg#1c2024#e6e8ebPrimary text.
--dg-muted#f2f3f5#26292fControl hover background, neutral surface.
--dg-muted-fg#667085#9aa2b1Secondary text.
--dg-border#d5d9e0#3a3f47Control border.
--dg-border-hover#b6bcc8#4d535dControl border on hover.
--dg-border-strong#858d9b#737b89Checkbox box, neutral sort icon (≥ 3:1).
--dg-head-bg#f6f7f9#1f2227Header row, <tfoot>, card header.
--dg-head-fg#596579#a3abb9Header text.
--dg-panel-bg#ffffff#212429Column menu, row menu, popovers.
--dg-panel-border#e4e7ec#3a3f47Panel border.
--dg-surface#ffffff#1b1d22Background of surface: "card".
--dg-danger#d93843#f0656eDestructive actions.

Tones ​

Used by badge chips, row tones, banners and states.

TokenLightDarkMeaning
--dg-tone-neutral#475467#a0afc5Neutral chip.
--dg-tone-info#1d63c8#66adffInfo chip and notes.
--dg-tone-ok#15803d#67c67fSuccess chip.
--dg-tone-warn#b45309#f78f54Warning chip and banner.
--dg-tone-bad#c0262d#ff756fError chip, banner and state.
--dg-row-ok#edf8f1#15281cRow background for rowTone "ok".
--dg-row-warn#fff6dc#2b2312Row background for "warn".
--dg-row-bad#fdeeee#2e1719Row background for "bad".
--dg-row-info#edf3fd#162133Row background for "info".

Accent derivatives ​

Component rules never use --dg-accent directly, only these. Static fallbacks are listed; modern browsers derive them with color-mix() and relative color syntax.

TokenDefaultMeaning
--dg-accent-solidvar(--dg-accent)Filled surfaces: checked checkbox, current page. Lightened in dark mode.
--dg-accent-fg#ffffffText and glyphs on --dg-accent-solid; modern browsers pick black or white by the accent's lightness.
--dg-accent-inkvar(--dg-accent)Accent as text, icon and focus border; modern browsers cap its lightness so it keeps ≥ 4.5:1 on white.
--dg-accent-weak#ecf1feTinted surface (9 % accent).
--dg-ringrgba(61, 99, 221, 0.24)Focus halo.

Derived neutrals ​

TokenDefaultMeaning
--dg-line#e5e6e7Row separator.
--dg-line-strong#d6d7d9Line under the header and above <tfoot>.
--dg-row-alt#f9f9f9Zebra row (striped).
--dg-veil-hoverrgba(28, 32, 36, 0.04)Row hover veil.
--dg-veil-selectedrgba(61, 99, 221, 0.10)Selected row veil.
--dg-veil-selected-hoverrgba(61, 99, 221, 0.14)Selected row on hover.
--dg-scrollbar-thumbrgba(28, 32, 36, 0.18)Scrollbar thumb.
--dg-skeleton#eceef1Loading placeholders.
--dg-overlayrgba(255, 255, 255, 0.55)Veil over the body while reloading.

Spacing and radius ​

TokenDefaultMeaning
--dg-space-10.25 × rem (4 px)Spacing scale on a 4 px grid.
--dg-space-28 px
--dg-space-312 px
--dg-space-416 px
--dg-space-520 px
--dg-space-624 px
--dg-space-832 px
--dg-radius-xs4 pxCheckbox, skeleton.
--dg-radius-sm6 pxMenu item, id pill, cell button.
--dg-radius-md8 pxControls.
--dg-radius-panel10 pxPanels (item radius + panel padding).
--dg-radius-surface12 pxCard surface.
--dg-radius-full999pxBadges, counters.

Typography ​

The font family is inherited from the host.

TokenDefaultMeaning
--dg-font-size-xs11 pxChips, caps headers.
--dg-font-size-sm12 pxSentence headers, footer info, captions.
--dg-font-size-md13 pxBody text at size: "md".
--dg-font-size-lg14 pxBody text at size: "lg".
--dg-line-height1.45Cells.
--dg-line-height-tight1.25Controls, chips.
--dg-weight-regular400
--dg-weight-medium500
--dg-weight-strong600
--dg-font-monoui-monospace, SFMono-Regular, Menlo, Consolas, monospaceMonospace text.
--dg-head-font-sizevar(--dg-font-size-xs) · sentence: var(--dg-font-size-sm)Header text size.
--dg-head-weight700 · sentence: 600Header weight.
--dg-head-transformuppercase · sentence: noneHeader case.
--dg-head-tracking0.06em · sentence: normalHeader letter spacing.

Shadows ​

TokenMeaning
--dg-shadow-xsSmall controls.
--dg-shadow-panelMenus and popovers (layered, low alpha; weaker in dark mode).
--dg-shadow-surfaceCard surface.
--dg-shadow-edge-startOverflow shadow of a column pinned to the start.
--dg-shadow-edge-endOverflow shadow of a column pinned to the end.
--dg-shadow-stuckSticky header while scrolled.

Motion ​

All motion is turned off under prefers-reduced-motion: reduce.

TokenDefaultMeaning
--dg-dur-1100msExits, micro feedback.
--dg-dur-2160msEntrances, panel opening.
--dg-dur-3220msChevron rotation.
--dg-ease-outcubic-bezier(0.22, 1, 0.36, 1)
--dg-ease-incubic-bezier(0.4, 0, 1, 1)
--dg-ease-inoutcubic-bezier(0.65, 0, 0.35, 1)

Stacking ​

Inside the table only; panels and dialogs use the browser's top layer and need no z-index.

TokenDefaultMeaning
--dg-z-sticky-col2Pinned columns.
--dg-z-sticky-head3Sticky header.
--dg-z-sticky-corner4Header cell of a pinned column.
--dg-z-overlay5Reload veil.

Size ​

md defaults; data-size="sm" / "lg" override them. On touch screens (pointer: coarse) controls grow to 44 px unless the size is already lg.

Tokensmmd (default)lgMeaning
--dg-font-size12 px13 px14 pxBody text.
--dg-control-h30 px34 px40 pxButtons, inputs, selects (44 px on touch).
--dg-control-pad-x8 px10 px12 pxControl padding.
--dg-control-radiusvar(--dg-radius-md)Control radius.
--dg-icon-size14 px16 px18 pxIcons.
--dg-check-size14 px16 px18 pxCheckboxes (18 px on touch).
--dg-cell-btn-h24 px28 px32 pxButtons inside cells.

Density ​

Independent of size: data-density="compact" / "comfortable" override the normal defaults.

Tokencompactnormal (default)comfortableMeaning
--dg-row-h28 px36 px44 pxRow height (acts as the cells' minimum height).
--dg-cell-pad-y4 px8 px12 pxVertical cell padding.
--dg-cell-pad-x8 px12 px14 pxHorizontal cell padding.
--dg-cell-btn-h22 px(size)(size)Cell buttons in compact rows.
--dg-cell-valigntopVertical alignment; keeps multi-line rows aligned.
--dg-head-hvar(--dg-row-h)Header row height.

Panels ​

TokenDefaultMeaning
--dg-panel-pad4 pxPanel padding.
--dg-panel-offset6 pxGap between a trigger and its panel.
--dg-panel-max-hmin(24 × rem, 70dvh)Panel height limit (scrolls beyond).
--dg-menu-item-h32 pxMenu item height (44 px on touch).

Host hooks ​

Variables the stylesheet reads but doesn't define:

VariableDefaultMeaning
--dg-row-bg—Background for specific rows, set from your own CSS (.dg-table tr.vip { --dg-row-bg: … }); wins over row tones and zebra.
--dg-max-h70vhHeight limit of the scroll area with maxHeight (set by that option) and with virtual rows.
--dg-clamp2Line count for content wrapped in <span class="dg-clamp"> (multi-line truncation).

Root attributes ​

The grid writes these on its root .dg; style against them, never against classes the grid toggles.

AttributeValuesSet by
data-stateloading, ready, empty, error, idleLoad status (idle = load: "manual" before loading).
data-sizesm, lg (absent = md)size option.
data-densitycompact, comfortable (absent = normal)density option.
data-dg-themelight, dark, system (absent = inherit)theme option.
data-dg-headsentence (absent = caps)head option.
data-dg-surfacecardsurface option.
data-dg-stripedpresentstriped: true.
data-dg-nowrappresentwrap: false.
data-dg-sticky-headpresentmaxHeight (sticky header).
data-dg-virtualpresentVirtual rows are active.
data-bpxs (< 480 px), sm (< 768 px), md (< 1024 px), lgWidth of the grid root (not the viewport). At xs the toolbar and footer stack and the pager becomes a select.

The scroll frame also carries data-overflow="start end" while the table scrolls horizontally, and data-busy="visible" while a reload runs longer than 300 ms. The full DOM contract is in Anatomy.

Released under the MIT License.