This is a basic copy button approach that
provides an indication that the copy occurred
with a brief update to the triggering button.
The b.quickCopy() method bakes in the same
functionality if you don't need additional
features.
html
<divid="targetDiv">This is the target text to copy with messaging</div><buttondata-s="copyText"data-r="restoreText">Copy Text</button>
javascript
exportconstb={};exportasyncfunctioncopyText(ev,__,___){if(awaitb.copy("#targetDiv")===true){ev.target.innerHTML="Copied";b.debounce("textCopy","restoreText",1400);}else{ev.target.innerHTML="Error: Text could not be copied";b.debounce("textCopy","restoreText",1400);}}exportfunctionrestoreText(_,__,el){el.innerHTML="Copy Text";}