Copy Button

Copies text; the icon morphs from two sheets into a check mark.

no dependenciesMIT · free
npx shadcn add @ombak/copy-button

Installation

npx shadcn@latest add https://ombakui.com/r/copy-button.json

Usage

import { CopyButton } from "@/components/copy-button";

<CopyButton value="npx shadcn add @ombak/copy-button" />
<CopyButton value={email} label="Copy email" />

Props

PropTypeDefaultDescription
value*string–The text to copy.
labelstring–Label next to the icon. Leave empty for an icon-only button.
copiedLabelstring"Copied"Label after copying.
resetAfternumber1600Milliseconds before returning to the idle state.
onCopied() => void–Called after a successful copy.
classNamestring–