Spin Theme Toggle
animated-theme-toggles/spinFreeBlock
Animated Theme Toggles publishes no description for this item.
Install it
npx shadcn@latest add https://toggles.dev/r/spin.jsonSource
1import { type ButtonHTMLAttributes, type CSSProperties, useId } from "react";23export interface SpinProps extends Omit<4 ButtonHTMLAttributes<HTMLButtonElement>,5 "children"6> {7 duration?: number;8 [key: `data-${string}`]: string | number | boolean | null | undefined;9}1011export function Spin({12 duration = 400,13 className,14 type = "button",15 title = "Toggle theme",16 "aria-label": ariaLabel = "Toggle theme",17 ...props18}: SpinProps) {19 const toggleId = useId();2021 const clipMainId = `toggles.dev-spin-main-${toggleId}`;2223 return (24 <button25 type={type}26 title={title}27 aria-label={ariaLabel}28 className={className}29 {...props}30 >31 <svg32 width="1em"33 height="1em"34 viewBox="0 0 24 24"35 aria-hidden="true"36 style={{ "--toggles-spin--duration": `${duration}ms` } as CSSProperties}37 >38 <defs>39 <clipPath id={clipMainId}>40 <path41 d={"M0 0h25a1 1 0 0010 10v14H0Z"}42 className="transition-[d,translate] duration-(--toggles-spin--duration) dark:delay-[calc(var(--toggles-spin--duration)*0.15)] dark:[d:path('M0_2h13a1_1_0_0010_10v14H0Z')] dark:not-supports-[d:path('M0_0')]:-translate-x-3.25 dark:not-supports-[d:path('M0_0')]:translate-y-0.5"43 />44 </clipPath>45 </defs>46 <g stroke={"currentColor"} strokeLinecap={"round"}>47 <circle48 cx={12}49 cy={12}50 r={5}51 fill={"currentColor"}52 clipPath={`url(#${clipMainId})`}53 className="origin-center transition-transform duration-(--toggles-spin--duration) dark:scale-170"54 />55 <path56 d={"M12 1.4v2.4"}57 fill={"none"}58 strokeWidth={2}59 strokeLinejoin={"round"}60 strokeMiterlimit={0}61 paintOrder={"stroke markers fill"}62 className="origin-center transition-transform duration-(--toggles-spin--duration) delay-[calc(var(--toggles-spin--duration)*0.15)] dark:delay-0 dark:rotate-45 dark:scale-0"63 />64 <path65 d={"m20.3 3.7-2.5 2.5"}66 fill={"none"}67 strokeWidth={2}68 strokeLinejoin={"round"}69 strokeMiterlimit={0}70 paintOrder={"stroke markers fill"}71 className="origin-center transition-transform duration-(--toggles-spin--duration) delay-[calc(var(--toggles-spin--duration)*0.15)] dark:delay-0 dark:rotate-45 dark:scale-0"72// … truncated
Files it writes
More from Animated Theme Toggles
All 14 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Around Theme Togglearound | Animated Theme Toggles | Blocks | Free | no deps | |
| Classic Theme Toggleclassic | Animated Theme Toggles | Blocks | Free | no deps | |
| Dark Inner Theme Toggledark-inner | Animated Theme Toggles | Blocks | Free | no deps | |
| Dark Side Theme Toggledark-side | Animated Theme Toggles | Blocks | Free | no deps | |
| Eclipse Theme Toggleeclipse | Animated Theme Toggles | Blocks | Free | no deps | |
| Expand Theme Toggleexpand | Animated Theme Toggles | Blocks | Free | no deps | |
| Half Sun Theme Togglehalf-sun | Animated Theme Toggles | Blocks | Free | no deps | |
| Horizon Theme Togglehorizon | Animated Theme Toggles | Blocks | Free | no deps |
