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
In the package
npm i hellskitchen-ui Import hkCopy and use it directly. 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
copiedstringEmits the copied text on success.
copyFailedErrorEmits when the browser refuses.
Methods
confirmed()Signal<boolean>True for copyResetDelay ms after a copy (exportAs "hkCopy"). The host also gets .hk-copied.
Keyboard
- Enter / Space Copies from a focused host
Theming
This one adds no tokens of its own — it renders entirely from the global token layer.
Accessibility
- It binds to click, so on a native button Enter and Space copy too.
- Failure surfaces as an output — a permission-blocked clipboard must not look like success.