Component
ThemeSwitcher
Render controlled light and dark theme controls in mini or full mode.
Interactive preview
Usage
Import the component entry and start with its smallest complete example.
Import
import { ThemeSwitcher } from "@chitrank2050/monoline-ui/theme-switcher"Basic usage
const [theme, setTheme] = useState<"light" | "dark">("light")
<ThemeSwitcher
mode="mini"
theme={theme}
onThemeChange={setTheme}
/>
<ThemeSwitcher
mode="full"
theme={theme}
onThemeChange={setTheme}
/>Usage guidance
Choose the component for its interaction model and semantics before customizing its appearance.
ThemeSwitcher handles a controlled light and dark choice as a compact button or full switch.
The app offers more than two themes, or the caller cannot manage persistence and document updates.
ThemeSwitcher supplies a state-specific accessible label and uses a native button in mini mode or a labeled switch in full mode.
This component needs browser JavaScript for state or browser APIs.
API reference
Props, slots, and callbacks available on this component.
Design tokens
Theme variables this component reads for color, spacing, and motion.
Implementation
The source used by the example above, including any state it needs.
import { ThemeSwitcher } from "@chitrank2050/monoline-ui/theme-switcher"
export function ThemeControl() {
const [theme, setTheme] = useState<"light" | "dark">("light")
return (
<ThemeSwitcher
mode="full"
theme={theme}
onThemeChange={setTheme}
/>
)
}Related documentation
Compare related components or review the package and theme setup.