asafefe.dev

Copy Button

A copy-to-clipboard button whose icon pops into a hand-drawn check, with a ring pulse on success.

motionlucide-reactutils@soultel/use-copy-to-clipboard
npm i soultel

Installation

$ pnpm dlx shadcn@latest add @soultel/copy-button

No namespace set up? npx shadcn@latest add https://asafefe.dev/r/copy-button.json works too.

Manual installation
  1. 1. Install the dependencies.
    terminal1 lines
    npm install motion lucide-react
  2. 2. Copy the source from the Code tab into components/copy-button.tsx.

Usage

example.tsx5 lines
import { CopyButton } from "@/components/copy-button"

export function Example() {
  return <CopyButton value="npm i soultel" />
}

Props

PropTypeDefaultDescription
valuestring-Text written to the clipboard.