Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

svelte-copy-to-clipboard

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-copy-to-clipboard

Copy to clipboard component for Svelte

latest
npmnpm
Version
0.2.5
Version published
Weekly downloads
294
50.77%
Maintainers
1
Weekly downloads
 
Created
Source

Svelte Copy to Clipboard

npm version License: MIT Build Status

Installation

npm i svelte-copy-to-clipboard
// OR
yarn add svelte-copy-to-clipboard

LIVE DEMO

Local demo:

git clone https://github.com/henriquecaraujo/svelte-copy-to-clipboard.git
cd svelte-copy-to-clipboard
yarn && yarn dev

Examples

<script>
  import CopyToClipboard from "svelte-copy-to-clipboard";
  let exampleText = 'Copy me!';

  const handleSuccessfullyCopied = (e) => {
      alert(`successfully copied to clipboard! ${e}`);
  }

  const handleFailedCopy = () => {
      alert('failed to copy :(');
  }
</script>

<CopyToClipboard text={exampleText} on:copy={handleSuccessfullyCopied} on:fail={handleFailedCopy} let:onCopy>
    <button on:click={onCopy}>An element to trigger the copy</button>
</CopyToClipboard>

Properties

Component props:

PropTypeDescription
textstringValue to copy
copyfuncCall when text's copied
failfuncCall when copy fails

Slot Properties

PropTypeDescription
onCopystringCall foi copy

NPM Statistics

Download stats for this NPM package

NPM

License

Svelte Copy to Clipboard is open source software licensed as MIT.

Keywords

svelte

FAQs

Package last updated on 25 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts