Dark Mode
When enabled (defaults to false), it will show the grid in Dark Mode by adding slick-dark-mode
CSS class to the grid. Note that it is defined as a grid option because the grid uses a few elements that could be appended to the DOM body
(e.g. ColumnPicker, GridMenu, LongTextEditor, CompositeEditorModal, ...) and when Dark Mode is enabled, it needs to inform all of these features that we are using Dark Mode (or Light Mode by default). So whenever any of these features are in play, and before it is appended to the body
, it will add a slick-dark-mode
(or ms-dark-mode
for ms-select) CSS class to that element to let it know that we are in Dark Mode.
Toggle Light/Dark Mode
You can easily toggle light/dark mode by using grid.setOptions()
How to Auto-Detect Dark Mode?
Composite Editor Modal (for Bootstrap users)
For Bootstrap
users, it will also require the developer to add a data-bs-theme="dark"
attribute which is also another reason why we added darkMode
as a grid option. So for Bootstrap users, you will have to add this required attribute by yourself for the Dark Mode to display properly. If you forget to add this attribute, you might see some of the filter inputs and other sections displayed with a white background instead of an expected dark gray backgroud.
Note the
onRendered
is a new lifecycle callback of Composite Editor Modal that was added specifically for this Bootstrap use case
Grid Menu
By default there is no command for toggling the Dark Mode from the Grid Menu, however you can show the command at any time via the following settings:
Tweaking Some Colors
Last updated