xxczaki / copy-text-to-clipboard

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

License:MIT License


Languages

Language:JavaScript 59.7%Language:HTML 33.0%Language:TypeScript 7.3%