Copy text to the clipboard in modern browsers (0.2 kB)
- This module: 0.2 kB
clipboard.js: 3.4 kB
$ npm install copy-text-to-clipboard
const copy = require('copy-text-to-clipboard');
button.addEventListener('click', () => {
copy('🦄🌈');
});Copy text to the clipboard.
Returns a boolean of whether it succeeded.
Must be called in response to a user gesture event, like click or keyup.
- clipboardy - Access the system clipboard (copy/paste) in Node.js
MIT © Sindre Sorhus