HyCopyButton
A button that copies a string to the clipboard with built-in feedback.
Copies either a static value or — via from — the resolved value of another element by id (from="tok", from="tok.value", from="link[href]"), runs a rest → success → error feedback machine that auto-reverts after feedback-duration, swaps the icon per state, and surfaces the state label through a built-in hy-tooltip (never title=).
Key Features:
value(static) orfrom(resolve another element by id / property / attribute)rest → success → errormachine with auto-revert- Per-state icon names + a11y/tooltip labels
- Optional
transformto wrap/trim before copy (e.g.v => \var(${v})``) size/emphasisforwarded to the innerhy-icon-button
Examples
Copy a static value
html
<hy-copy-button value="--hy-background-brand-rest"></hy-copy-button>Copy the resolved value of another element
html
<code id="tok">#4f46e5</code> <hy-copy-button from="tok"></hy-copy-button>Events
- copy - Fired after a successful copy. Detail:
{ value: string } - error - Fired when the clipboard write fails (non-bubbling; listen on the element). Detail:
{}