Copy Button
Copy text to the clipboard with success feedback.
Import
tsx
import { CopyButton } from "@cronus-ui/ui";
bash
npx cronus-ui add copy-button
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component CopyButtonDefault layout:inline style:copy-button {
value:"cronus-ui"
aria-label:"Copy"
label "Copy"
}
page "/audit/copy-button/default" type:custom {
use CopyButtonDefault
}
API Reference
Generated from the component's exported types.
CopyButtonProps
Extends Omit<ButtonProps, "value" | "children">
| Prop | Type | Default | Description |
|---|---|---|---|
value* | string | — | Text written to the clipboard when the button is pressed. |
timeout | number | 1500 | Milliseconds the "copied" state stays visible before reverting. Defaults to 1500. |
copyLabel | string | "Copy" | Accessible label shown to assistive tech in the idle state. Defaults to "Copy". |
copiedLabel | string | "Copied" | Accessible label announced after a successful copy. Defaults to "Copied". |
variant | string | — | Visual variant. |
size | string | — | Control size. |
asChild | boolean | — | Render as the child element via Slot. |
disabled | boolean | — | Disables pointer and keyboard interaction. |
type | string | — | Native type of the underlying element. |
className | string | — | Additional class names merged onto the root. |