Simple Svelte based button that copies the current url.
For Sapper you need to install the package as a dev module to so it gets compiled. If you install it as a runtime dependency you will 500 errors on the server side. This is explained here.
$ npm i -D svelte-copy-url-button
$ npm i --save svelte-copy-url-button
Basic usage from svelte looks like this:
<script>
import SvelteCopyUrlButton from 'svelte-copy-url-button';
// If url is not passed it will copy the url of the current page
let url = "https://svelte-copy-url-button.netlify.app/"
</script>
<SvelteCopyUrlButton
class="customClassName"
size="14"
defaultText="Copy url"
copiedText="Copied!"
icon="{false}"
timeout="1000"
url="{url}"
/>
Demo with some of the options can be viewed here