Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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

  • 0.2.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
507
decreased by-21.76%
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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc