Browse components
Icon Shift
Swaps one icon for another in place: the old one shrinks, blurs and turns away while the new one turns in and pops to size. Wrap any icon and change its key.
Installation
npx shadcn@latest add @glint-ui/icon-shiftFirst time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/icon-shift.json
Usage
import { IconShift } from "@/components/ui/icon-shift";
<IconShift swapKey={copied}>
{copied ? <Check /> : <Copy />}
</IconShift>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| rotate | number | 45 | Degrees the icons turn while swapping. |
| blur | number | 4 | Blur in px at the swap's start and end. |
| shrink | number | 0.4 | Scale the icons shrink to while swapping. |
| duration | number | 0.28 | Swap length in seconds. |
| swapKey | ReactNode | — | Identifies the current icon; changing it triggers the swap. |
| className | string | — | Extra classes for the root element. |