All components
Copy Button
ButtonsCopies a value and confirms with an icon swap.
Installation
Add it with the shadcn CLI:
$
pnpm dlx shadcn@latest add https://nawalkattel.com.np/r/copy-button.jsonOr install manually
1. Install dependencies
pnpm add motion clsx tailwind-merge lucide-react2. Copy the component source into
components/library/copy-button.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Text to copy. |
| className | string | - | Classes applied to the button. |
Accessibility
- aria-label switches between “Copy” and “Copied” to announce the result.
- Fails silently when the clipboard API is unavailable.
Dependencies
motionclsxtailwind-mergelucide-react