Nusa UINusa UI

A button that copies text to the clipboard with visual feedback.

registry/examples/copy-button-demo.tsx
import { CopyButton } from "@/registry/ui/copy-button"

export default function CopyButtonDemo() {

Installation

pnpmnpmyarnbun
pnpm dlx shadcn@latest add https://nusa-ui.vercel.app/r/copy-button.json

Usage

import { CopyButton } from "@/components/ui/copy-button"
<CopyButton value="Text to copy" />

Examples

With Text

Display next to a code snippet or command.

registry/examples/copy-button-with-text.tsx
import { CopyButton } from "@/registry/ui/copy-button"

export default function CopyButtonWithText() {

Custom Content

Use custom text or icons inside the button.

registry/examples/copy-button-custom.tsx
import { CopyButton } from "@/registry/ui/copy-button"

export default function CopyButtonCustom() {

API Reference

CopyButton

Extends the Button component with copy functionality.

PropTypeDefaultDescription
valuestring-The text to copy to clipboard
onCopy() => void-Called after successful copy
timeoutnumber2000Duration of success state (ms)
variantstring"outline"Button variant
sizestring"icon"Button size

All other Button props are supported.