You can use the Clipboard API to create a “Copy to Clipboard” function.

function copyToClipboard(text) {
  navigator.clipboard.writeText(text)
}