- Accordion
- Alert Dialog
- Alert
- Autocomplete
- Avatar
- Badge
- Button Group
- Button
- Card
- Carousel
- Chart
- Checkbox
- Clipboard
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Editable
- Field
- File Upload
- Floating Panel
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- QR Code
- Radio Group
- Rating Group
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Spinner
- Splitter
- Steps
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle Group
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add @shark-ui/clipboard
Usage
import { Clipboard, ClipboardTrigger, ClipboardIndicator } from "@/components/ui/clipboard";
<Clipboard value="https://x.com/vinihvc"> <ClipboardTrigger> <ClipboardIndicator /> </ClipboardTrigger> </Clipboard>
Examples
Icon Only
Different Icons
Use the copied prop on <ClipboardIndicator /> to customize the icon shown when copied.
Add a children to the <ClipboardIndicator /> to customize the icon shown when not copied.
Custom Timeout
Use the timeout prop on <Clipboard /> to customize how long the copied state is shown.
Controlled
Use the onStatusChange prop to control the clipboard value programmatically.
Value Text
Use <ClipboardValueText /> to display the value as text instead of an input field.
API Reference
Clipboard
Root element of the clipboard. Renders a div
| Prop | Type | Default |
|---|---|---|
value | string | required |
timeout | number | 2000 |
onStatusChange | ({ copied }: StatusChangeDetails) => void | - |
className | string | - |
ClipboardTrigger
Button that triggers the copy action. Renders a button
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
className | string | - |
ClipboardInput
Input field that displays the value. Renders an input
| Prop | Type | Default |
|---|---|---|
className | string | - |
ClipboardIndicator
Indicator that shows different icons based on the copied state. Renders a span
| Prop | Type | Default |
|---|---|---|
copied | ReactNode | <Check /> |
className | string | - |
ClipboardValueText
Text element that displays the value. Renders a span
| Prop | Type | Default |
|---|---|---|
size | "xs", "sm", "md", "lg", "xl" | "md" |
className | string | - |
For a complete list of props, see the Ark UI documentation.