Icon toggle
Installation
1. Install dependencies
npx shadcn-animated add button
2. Install icon toggle
npx shadcn-animated add icon-toggle
Usage
1import { IconToggle } from "@/components/ui/icon-toggle";2import { Sun, Moon } from "lucide-react";
1<IconToggle2from={<Sun />}3to={<Moon />}4/>
Auto reset
Automatically switches back to the initial icon after 3 seconds.
1<IconToggle2autoReset3from={<Copy className="size-6" />}4to={<Check className="size-6" />}5/>
Specify delay
Set how long to wait before automatically switching back to the initial icon.
1<IconToggle2autoReset3resetDelay={4000}4from={<Copy className="size-6" />}5to={<Check className="size-6" />}6/>
Specify variant, size, or className
Customize the button using the same variant, size, and className options as shadcn/ui.
1<IconToggle2variant="secondary"3className="p-8 rounded-full hover:bg-backgound"4from={<Copy className="size-6" />}5to={<Check className="size-6" />}6/>