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

NameTypeDefaultDescription
hkCopystring''Text to write to the clipboard.
copyResetDelaynumber1600How long the confirmed state lasts.

Outputs

  • copiedstring

    Emits the copied text on success.

  • copyFailedError

    Emits 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.

More in Utility