Skip to content

huruji/copy-text-to-clipboard

 
 

Repository files navigation

copy-text-to-clipboard Build Status

Copy text to the clipboard in modern browsers (0.2 kB)

Try it out!

Comparison

Install

$ npm install copy-text-to-clipboard

Usage

const copy = require('copy-text-to-clipboard');

button.addEventListener('click', () => {
	copy('🦄🌈');
});

API

copy(text)

Copy text to the clipboard.

Returns a boolean of whether it succeeded to copy the text.

Must be called in response to a user gesture event, like click or keyup.

Related

  • clipboardy - Access the system clipboard (copy/paste) in Node.js

License

MIT © Sindre Sorhus

About

Copy text to the clipboard in modern browsers (0.2 kB)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 58.6%
  • HTML 33.9%
  • TypeScript 7.5%