Clipboard
stable 0.4 kB<hkCopy>Copy with a confirmation state that reverts itself — and reports failure, because the Clipboard API is refused often enough that silence is a bug.
#directive#copy
Live demo
Running in this page — interact with it.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| hkCopy | string | '' | Text to write to the clipboard. |
| copyResetDelay | number | 1600 | How long the confirmed state lasts. |
Outputs
copiedEventEmitter<string>Emits the copied text on success.
copyFailedEventEmitter<Error>Emits when the browser refuses.
Keyboard
- Enter / Space Copies from a focused host
Theming
Component tokens, each falling back to a global one:
| Property | Default | Controls |
|---|---|---|
| --hk-copy-success | #059669 | Confirmed state colour. |
Accessibility
- Success is announced through an aria-live region, so it is not conveyed by the tick alone.
- Failure surfaces as a message — a permission-blocked clipboard must not look like success.