svelte-copy-url-button
v1.0.6
Published
Svelte based button component that copies the current url.
Downloads
10
Maintainers
Readme
svelte-copy-url-button
Simple Svelte based button that copies the current url.
Installation
Using npm
Sapper or Other Svelte Bundler
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
PureJS
$ npm i --save svelte-copy-url-button
Usage
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}"
/>