Socket
Socket
Sign inDemoInstall

svelte-copy-to-clipboard

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    svelte-copy-to-clipboard

Copy to clipboard component for Svelte


Version published
Weekly downloads
1.1K
increased by20.55%
Maintainers
1
Install size
9.25 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 25 May 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc