Global dark mode
LumexUI supports both light and dark modes.
To enable dark mode globally, simply add the dark class
to a wrapper element such as html or body.
Theme toggling
LumexUI offers a simple theme-switching mechanism made up of two key parts:
- A theme provider component that sets the initial theme on first load.
- A theme service that enables dynamic theme changes at runtime.
Add the theme provider
Insert the LumexThemeProvider into your MainLayout.razor file:
The LumexThemeProvider component requires interactivity.
If you're using the Blazor Web App template, make sure to apply the appropriate @rendermode.
Add a mode toggle
Add a mode toggle to the UI for switching between light and dark modes.