shadcn.io is not affiliated with official shadcn/ui
Framework
UI library
Radix UI does not include this primitive, so this page uses the Ark UI component. The visuals match the Ark UI version.
Installation
bunx --bun shadcn@latest add https://kit.dev/r/radix/clipboard.jsonAnatomy
Clipboard
├── ClipboardControl
├── ClipboardTrigger
├── ClipboardIndicator
├── ClipboardInput
└── ClipboardLabelUsage
import { SITE_URL } from "@/lib/brand";
import { Button } from "@/components/ui/button";
import {
Clipboard,
ClipboardIndicator,
ClipboardInput,
ClipboardTrigger,
} from "@/components/ui/clipboard";<div className="w-full max-w-sm">
<Clipboard value={SITE_URL}>
<ClipboardInput />
<ClipboardTrigger asChild>
<Button size="icon-md">
<ClipboardIndicator />
</Button>
</ClipboardTrigger>
</Clipboard>
</div>Accessibility
| Key | Description |
|---|---|
Enter | Activate the focused control. |
Space | Activate the focused control. |
Demos
Context
Controlled
Copy Status
Custom Timeout
Different Icon
Icon Only
Root Provider
Value Text
With Label
API Reference
Clipboard
div
PropType
AttributeType
ClipboardControl
div
PropType
AttributeType
ClipboardTrigger
button
PropType
AttributeType
ClipboardIndicator
div
PropType
AttributeType
ClipboardInput
input
PropType
AttributeType
ClipboardLabel
label
PropType
AttributeType
ClipboardValue
span
PropType
AttributeType
ClipboardRootProvider
div
PropType
valueUseClipboardReturnAttributeType
useClipboard
PropType
ClipboardContext
PropType