Skip to main content

Theme Switcher

Pick light, dark or the system's theme in one control, built on Base UI.

Installation

Component API

PropTypeDefaultDescription
valuelight | dark | system-
defaultValuelight | dark | systemsystemThe theme picked on first render, uncontrolled.
The theme picked on first render, uncontrolled.
onValueChange(value: "light" | "dark" | "system") => void-
storageKeystring-
iconOnlybooleanfalse
variantsegmented | cyclesegmentedsegmented shows every theme on a track; cycle is one button that moves System, Light, Dark on each press, showing the current one.
segmented shows every theme on a track; cycle is one button that moves System, Light, Dark on each press, showing the current one.
sizesm | mdmdHeight of the track and its options, or of the cycle button.
Height of the track and its options, or of the cycle button.
shapenone | rounded | pillrounded
disabledbooleanfalseBlocks every option and dims the control.
Blocks every option and dims the control.
animatedbooleantrue
classNamestring-
focusboolean | stringtrue