Expand Theme Toggle
animated-theme-toggles/expandFreeBlock
Animated Theme Toggles publishes no description for this item.
Install it
npx shadcn@latest add https://toggles.dev/r/expand.jsonSource
1import { type ButtonHTMLAttributes, type CSSProperties, useId } from "react";23export interface ExpandProps extends Omit<4 ButtonHTMLAttributes<HTMLButtonElement>,5 "children"6> {7 duration?: number;8 [key: `data-${string}`]: string | number | boolean | null | undefined;9}1011export function Expand({12 duration = 500,13 className,14 type = "button",15 title = "Toggle theme",16 "aria-label": ariaLabel = "Toggle theme",17 ...props18}: ExpandProps) {19 const toggleId = useId();2021 const clipMainId = `toggles.dev-expand-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 32 32"35 aria-hidden="true"36 fill={"currentColor"}37 style={38 { "--toggles-expand--duration": `${duration}ms` } as CSSProperties39 }40 >41 <defs>42 <clipPath id={clipMainId}>43 <path44 d={"M0-11h25a1 1 0 0017 13v30H0Z"}45 className="transition-[d,translate] [transition-duration:calc(var(--toggles-expand--duration)_*_0.6)] [transition-timing-function:cubic-bezier(0,0,0.5,1)] [transition-delay:0s] dark:[d:path('M0_0h15A1_1_0_0032_15v17H0Z')] dark:not-supports-[d:path('M0_0')]:-translate-x-[5px] dark:not-supports-[d:path('M0_0')]:translate-y-[11px] dark:[transition-timing-function:cubic-bezier(0,0,0,1.25)] dark:[transition-delay:calc(var(--toggles-expand--duration)_*_0.4)]"46 />47 </clipPath>48 </defs>49 <g clipPath={`url(#${clipMainId})`}>50 <circle51 cx={16}52 cy={16}53 r={8.4}54 className="[transform-origin:center] [transition:transform_calc(var(--toggles-expand--duration)_*_0.65)_cubic-bezier(0,0,0,1.25)_calc(var(--toggles-expand--duration)_*_0.35)] dark:[transform:scale(1.6)] dark:[transition:transform_calc(var(--toggles-expand--duration)_*_0.65)_cubic-bezier(0,0,0,1.25)]"55 />56 <path57 d={58// … 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 | |
| Half Sun Theme Togglehalf-sun | Animated Theme Toggles | Blocks | Free | no deps | |
| Horizon Theme Togglehorizon | Animated Theme Toggles | Blocks | Free | no deps | |
| Inner Moon Theme Toggleinner-moon | Animated Theme Toggles | Blocks | Free | no deps |
