AG Grid Themes

View as Markdown

Summary

  • AdapTable works with AG Grid Theming API and legacy theming — no extra AdapTable config for built-in themes
  • Quartz, Alpine, Balham, and Material switch light/dark modes with AdapTable's light / dark / os themes
  • Custom grid branding pairs custom theme modes with AdapTable via SystemThemeOptions.AgThemeMode — full walkthrough demo on Theming AdapTable UI

Topics on this Page

TopicSummary
Theming APIAG Grid 33+ theme option
Built-in themesQuartz, Alpine, Balham, Material
Custom AG Grid themeswithParams + AgThemeMode
CSS cascade layersthemeCssLayer and the layer order

Theming API

AdapTable supports AG Grid's Theming API (AG Grid 33+):

import {GridOptions, themeQuartz} from 'ag-grid-community';

const options: GridOptions = {
  theme: themeQuartz,
};

Legacy theming (theme: 'legacy') remains supported — see AG Grid legacy theming.

Built-in AG Grid themes

AdapTable works with built-in AG Grid themes. When users change AdapTable's theme, AdapTable switches the grid's light/dark mode for those themes automatically.

AG Grid Themes
Fork
  • Built-in AG Grid themes with AdapTable
  • Switching AdapTable light / dark updates the grid theme mode
Try It Out
  • Use the AdapTable Custom Toolbar to switch Dark and Light
  • Use the AG Grid toolbar to switch Quartz, Alpine, Balham, and Material
Loading demo…

Custom AG Grid themes

AdapTable supports custom AG Grid themes.

Hint

Set SystemThemeOptions.AgThemeMode on each SystemThemes entry so AdapTable applies the right grid mode when users switch theme.

Pair AdapTable CSS variable overrides (from DevTools — Theme Builder or hand-written CSS) with custom themeQuartz.withParams(...) modes — the Co-ordinated Themes demo on the theming handbook shows the full light/dark brand.

AG Grid Custom Theme
Fork
  • Registers light-red and dark-red modes on themeQuartz
  • Pairs them with AdapTable system themes via AgThemeMode
Try It Out
  • Switch Light and Dark in the toolbar — the custom grid theme follows
Loading demo…

Find Out More

CSS cascade layers

AdapTable's CSS is in these cascade layers: adaptable.reset, adaptable.components, adaptable.utilities and adaptable.theming.

AG Grid's theme CSS is unlayered by default, so it takes precedence over all of AdapTable's layers.

AG Grid's themeCssLayer GridOptions property puts the theme CSS in a named layer, and AG Grid inserts it at the top of the document <head>.

Caution

If AG Grid's layer is declared before AdapTable's layers, AdapTable's reset styles take precedence over AG Grid's theme (e.g. AG Grid buttons lose their padding and the Side Bar tabs collapse)

When using themeCssLayer, also set themeStyleContainer to document.body.

This makes AG Grid's theme CSS come after AdapTable's CSS, so AG Grid's layer is declared after AdapTable's layers:

const gridOptions: GridOptions = {
  theme: themeQuartz,
  themeCssLayer: 'ag-grid',
  themeStyleContainer: document.body,
};

Hint

If the application's CSS declares its own layer order with an @layer statement, list AG Grid's layer after AdapTable's layers, e.g. @layer adaptable.reset, adaptable.components, adaptable.utilities, adaptable.theming, ag-grid;

FAQ

Theming API or legacy? Prefer the Theming API on current AG Grid versions; AdapTable supports both.

Where is the full AdapTable + grid brand demo? Co-ordinated Themes on the theming handbook — this page focuses on grid configuration.