Copy Button
Copies its text on click. The icon turns into a check and the tooltip reads Copied for two seconds, then both revert.
Installation
Copy the command below and run it in your terminal.
Usage
text is required. The button is icon-only by default, so label sets both the tooltip and the accessible name. To show a visible label, pass children
and a text size such as sm; the default icon size clips text.
The tooltip opens after 125ms. Raise tooltipDelay in a row of message actions so tooltips appear only when the pointer rests. duration sets how long the copied state holds (2000ms by default), and oncopy fires after a successful write.
Examples
In a field
bunx sv create my-app Variants
Anatomy
CopyButton - Copies text to the clipboard.
<script lang="ts"> import { CopyButton } from '@sivir-ui/svelte/components/copy-button'; </script> <CopyButton text="bun add @sivir-ui/svelte" />