One key on its plate that switches light and dark: the sun's rays retract and a mask cuts the core into a crescent, and the page sweeps to the new theme behind a 1px signal line, from the side of the change.
pnpm dlx shadcn@latest add https://beautiful-ui.dev/r/theme-switch.jsonpnpm dlx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/theme-switch.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.
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { ThemeSwitch, type ThemeName } from "@/components/ui/notchset/theme-switch";
/** With next-themes: const { resolvedTheme, setTheme } = useTheme(), and pass those instead. */
export function ThemeToggle() {
const [theme, setTheme] = React.useState<ThemeName>("light");
React.useEffect(() => {
document.documentElement.classList.toggle("dark", theme === "dark");
}, [theme]);
return <ThemeSwitch theme={theme} onThemeChange={setTheme} />;
}theme / onThemeChange–
"light" | "dark" / (theme) => voidControlled, e.g. with next-themes' resolvedTheme and setTheme.
defaultTheme–
"light" | "dark"Uncontrolled start. Without either, it reads and toggles the dark class on <html> and saves the choice under localStorage "theme".
label–
stringThe key's label. Default "SWITCH THEME".
iconOnly–
booleanA 40×40 key.
sweep–
booleanThe View Transitions sweep. Default true; instant without support or under reduced motion.
labels–
{ toDark?, toLight? }The accessible names.
components/ui/notchset/theme-switch.tsx