Light/Dark Mode
The DataGrid automatically adapts to the user’s system preference using thelight-dark() CSS function. The theme switches based on the color-scheme CSS property.
Automatic Theme Switching
To enable automatic theme switching based on system preferences, setcolor-scheme on the root element:
Force a Specific Theme
You can enforce a specific theme for your entire application:Per-Grid Theme Control
Alternatively, apply therdg-light or rdg-dark class to individual grids:
The
rdg-light and rdg-dark classes override the system preference for individual grid instances.Theme Customization
While the DataGrid provides sensible defaults for both light and dark modes, you can customize the appearance using CSS Variables or by applying Custom Classes.Combining with CSS Variables
Browser Compatibility
The DataGrid’s theming system uses modern CSS features:color-schemeproperty (supported in all modern browsers)light-dark()function (Chrome 123+, Firefox 120+, Safari 17.5+)
Vite 8+ users: If using
lightningcss for minification, you may need to adjust your build configuration due to a known bug with light-dark() syntax.