Copy Button
Copy text to clipboard with visual feedback and animation.
Loading...
Installation
pnpm dlx shadcn@latest add https://jb.desishub.com/r/copy-button.json
Usage
import { CopyButton } from "@/components/copy-button";<CopyButton text="Text to copy" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | (() => string) | - | The text to copy. |
onCopySuccess | (text: string) => void | - | Called with the copied text on success. |
onCopyError | (error: Error) => void | - | Called with the error if copy fails. |
idleIcon | React.ReactNode | CopyIcon | Custom icon for idle state. |
doneIcon | React.ReactNode | CheckIcon | Custom icon for done state. |
errorIcon | React.ReactNode | CircleXIcon | Custom icon for error state. |

