Theme toggle
- from @knowns-ui
Light/dark (or light/dark/system) toggle that reveals the new theme with a View Transition: a circle from the click point (the button centre for keyboard), a wipe, or a fade. Sun-to-moon icon morph. Instant without View Transitions or under reduced motion. Controlled or uncontrolled (localStorage + .dark on html), SSR-safe, with themeScript() for no flash and transitionTheme() for menus.
Install
New to shadcn? Set up your project
If your project already has a shadcn components.json, skip initialization. Otherwise, run this once from your project root.
pnpm dlx shadcn@latest initpnpm dlx shadcn@latest add @knowns-ui/theme-toggleLive preview
No live preview has been built for this component yet.
Registry dependencies3
Packages0
No npm packages are installed with it.
