Download src/components/ThemeToggle.tsx from web-zero/ui: direct link, hf CLI and curl.
- Browser
- Download file 433 Bytes
-
https://huggingface.co/spaces/web-zero/ui/resolve/main/src/components/ThemeToggle.tsx
- Command line
-
hf download hf://spaces/web-zero/ui/src/components/ThemeToggle.tsx
-
curl -L -o ThemeToggle.tsx https://huggingface.co/spaces/web-zero/ui/resolve/main/src/components/ThemeToggle.tsx
433 Bytes
| "use client"; | |
| import { useTheme } from "next-themes"; | |
| import { Moon, Sun } from "lucide-react"; | |
| import { Button } from "@/components/ui/button"; | |
| export default function ThemeToggle() { | |
| const { theme, setTheme } = useTheme(); | |
| return ( | |
| <Button | |
| variant="ghost" | |
| size="icon" | |
| onClick={() => setTheme(theme === "dark" ? "light" : "dark")} | |
| > | |
| {theme === "dark" ? <Sun /> : <Moon />} | |
| </Button> | |
| ); | |
| } | |