Color ModeFreev1.0.0
Light, Dark and System in one small control with a lit thumb that slides to the choice, or one round button that cycles. It applies the .dark class and remembers the choice, with System following the OS live, or drives your own theme code.
pnpm dlx shadcn@latest add https://beautiful-ui.dev/r/lumen-color-mode.jsonpnpm dlx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/lumen-color-mode.jsonFree, no account or key. Use the command for your project's primitives: a radix-*, new-york or default style in components.json is Radix, a base-* style is Base UI. With the @beautiful-ui registry added, @beautiful-ui/<name> picks for you.
Usage
Import it and pass your content. The props that matter most are listed next.
import { ColorMode } from "@/components/ui/lumen/controls/color-mode";
<ColorMode />
// With next-themes
const { theme, setTheme } = useTheme();
<ColorMode apply={false} value={theme as "light" | "dark" | "system"} onValueChange={setTheme} />Props
look"segmented""segmented" | "toggle"Three choices side by side, or one button that cycles.
showLabelsfalsebooleanWords beside the icons (segmented).
value / defaultValue / onValueChange"system""light" | "dark" | "system"Controlled or not.
applytruebooleanSet .dark on <html> and remember the choice. false: only report it (use with next-themes' setTheme).
storageKey"theme"stringWhere the choice is remembered.
labels–Partial<Record<choice, string>>The words, for other languages.
Source
components/ui/lumen/controls/color-mode.tsx