Dark mode

Set the theme on the document root to load the corresponding palette.

Set a theme

Use data-theme="dark" for the dark palette or data-theme="light" for the light palette.

<html lang="en" data-theme="dark">

Use the theme control in the docs to preview components in both palettes.

Switch the theme

Set the root attribute when your application’s theme changes. Your application can choose how it stores the preference and whether it follows the operating system.

document.documentElement.dataset.theme = "light";