Example from hyperscript.org landing page
The "Install" script tag copy button demonstrates using the Clipboard API with hyperscript.
Copy text to clipboard, show feedback, and restore the button text.
Demo 1: Script Tag Copy (Exact Landing Page Example)
Paste here to verify the copy worked (Ctrl+V / Cmd+V):
The Exact Code
<button _="on click
writeText(my previousElementSibling's innerText) on navigator.clipboard
put 'copied!' into me
wait 1s
put 'copy' into me">copy</button>
Simplified Version
<code class="install-code">npm install hyperfixi</code>
<button class="copy-btn"
_="on click
writeText(my previous.innerText) on navigator.clipboard
put 'copied!' into me
add .copied to me
wait 1s
put 'copy' into me
remove .copied from me">copy</button>
Features Demonstrated
writeText(...) on navigator.clipboard - Clipboard API access
my previous - Reference to previous sibling element
my previousElementSibling's innerText - Possessive property access