docs/components/clipboard
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Copy text to the clipboard.
PreviewCode
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/clipboard
Clipboard
├── ClipboardTrigger
│ └── ClipboardIndicator
├── ClipboardInput
└── ClipboardValue
import {
Clipboard,
ClipboardTrigger,
ClipboardIndicator
} from "@/components/ui/clipboard";
<Clipboard value="https://x.com/vinihvc">
<ClipboardTrigger asChild>
<Button size="icon-md">
<ClipboardIndicator />
</Button>
</ClipboardTrigger>
</Clipboard>
PreviewCode
Change URL
PreviewCode
PreviewCode
Use ClipboardValue component to display the value as text instead of an input field.
PreviewCode
Use the timeout prop on Clipboard to customize how long the copied state is shown.
PreviewCode
Root wrapper. Manages copy state and value.
| Prop | Type | Default |
|---|---|---|
value | string | required |
timeout | number | 2000 |
className | string | - |
Triggers copy to clipboard on click.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Input showing the value to copy. Often hidden or read-only.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Icon that changes based on copy state.
| Prop | Type | Default |
|---|---|---|
copied | ReactNode | CheckIcon |
className | string | - |
Text display of the value. Use when input is not needed.
| Prop | Type | Default |
|---|---|---|
size | `"xs" | "sm" |
className | string | - |
asChild | boolean | false |
For a complete list of props, see the Ark UI documentation.
[
Previous page
Circular Slider ](/docs/components/circular-slider)[
Next page
Collapsible ](/docs/components/collapsible)
On This Page
InstallationAnatomyUsageControlledExamplesIcon OnlyDifferent IconsValue TextCustom TimeoutAPI ReferenceClipboardClipboardTriggerClipboardInputClipboardIndicatorClipboardValue