Search

Search the site

All components

Copy Button

A button component for copying text to the clipboard.

Default
Copy CTA for commands and snippets.
1"use client";
2
3import { CopyButton } from "@/registry/ui";
4
5export function CopyButtonDefaultExample() {
6 return (
7 <div className="flex justify-center">
8 <CopyButton value="npm install @acme/ui">Copy</CopyButton>
9 </div>
10 );
11}

Installation & source

Install via the shadcn CLI or copy the registry files manually.

bash
npx shadcn@latest add @tt-ui/copy-button

Props

NameTypeDefaultDescription
valuestringRequiredThe text to copy to the clipboard
childrenReact.ReactNodeRequiredThe content of the copy button
copiedTextstringCopied!The text to show when the text is copied
copyLabelstringCopyThe text to show when the text is not copied
copiedLabelstringCopiedThe text to show when the text is copied
timeoutMsstring1500The time to show the copied text
classNamestringThe class name of the copy button
variantstringoutlineThe variant of the copy button
sizestringsmThe size of the copy button