nessra uinessra ui

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

Loading...
import { CopyButton } from "@/components/ui/copy-button"

export function CopyButtonDemo() {

Installation

pnpmnpmyarnbun
pnpm dlx shadcn@latest add https://nessra-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.

Loading...
import { CopyButton } from "@/components/ui/copy-button"

export function CopyButtonWithText() {

Custom Content

Use custom text or icons inside the button.

Loading...
import { CopyButton } from "@/components/ui/copy-button"

export 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.