Theme Picker

Light, dark and system theme picker as a segmented radiogroup that toggles the dark class on the root element for Tailwind dark mode and reports it to onChange.

src/registry/ui/theme-picker.tsx/r/theme-picker.json

Installation#

bash
npx shadcn@latest add @minidev/theme-picker

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/theme-picker.json

Usage#

tsx
import { ThemePicker } from "@/components/ui/theme-picker"

export function Example() {
  return <ThemePicker />
}

API reference#

ThemePicker props
PropTypeDefault
value"light" | "dark" | "system""system"
onChange(v: "light" | "dark" | "system") => void-
classNamestring-
All settings page components

Learn more