- Get started
Dark mode
Light, dark or the visitor's system setting, with no code per block.
Steps
Pick a mode
system follows the operating system, light and dark pin it.
<Theme theme="brand" mode="system">…</Theme>Offer a toggle
The navbar's theme toggle sends kh:theme-toggle. Theme handles it; a later change of the system setting takes over again.
// navbar-simple props { themeToggle: true }Remember the choice
Nothing is stored for you. If you want the choice to survive a reload, save it and pass it as mode.
const saved = localStorage.getItem('mode') ?? 'system'; <Theme mode={saved}>…</Theme>