{"name":"copy-text-to-clipboard","version":"3.1.0","description":"Copy text to the clipboard in modern browsers (0.2 kB)","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/copy-text-to-clipboard.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12"},"scripts":{"//test":"xo && tsd","test":"xo"},"keywords":["copy","text","clipboard","browser","clipboard.js","modern"],"devDependencies":{"tsd":"^0.14.0","xo":"^0.37.1"},"xo":{"envs":["browser"]},"types":"./index.d.ts","gitHead":"afb54daab55999efaa77d454b716a60128c480c9","bugs":{"url":"https://github.com/sindresorhus/copy-text-to-clipboard/issues"},"homepage":"https://github.com/sindresorhus/copy-text-to-clipboard#readme","_id":"copy-text-to-clipboard@3.1.0","_nodeVersion":"18.14.2","_npmVersion":"9.2.0","dist":{"integrity":"sha512-PFM6BnjLnOON/lB3ta/Jg7Ywsv+l9kQGD4TWDCSlRBGmqnnTM5MrDkhAFgw+8HZt0wW6Q2BBE4cmy9sq+s9Qng==","shasum":"6bf40deef0a51ac6858efb0d76ded2c6d6a15059","tarball":"http://registry-npm.ywwl.com/copy-text-to-clipboard/download/copy-text-to-clipboard-3.1.0.tgz","fileCount":5,"unpackedSize":5092,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCuaHZ8f24lQlc/8r2XhcHRXndzCcsGScy/5J0tgczihwIgF0sCNl00rcbqqvXHYJqbCvc1X5e575LvpLg63VzbDb8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkDDmPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqvtg//fitQAxX+9UQIj7LbD9hdXdFMbQ1ACCuUmQYFf1hLFr72rtKW\r\n7YF28FIxCXGK35EPmC8tM7qXBD0H24CKfTZePPcEHp5rvP0VYTmmLpuZvfbB\r\nmnCqE7pw2jUrJF8iyPrhROToD3Dr+8Q24XtwsdE0SsmBtvQlFFBixpzI00kl\r\n9ro7/3SmXkezqGKZ/IliZkWQEr2bion75aNoRbqYjM9IqIvLoRfNnB6KjhY+\r\nOGvhoRawW/7YjKjyC0Wg2P727oteezBLcTuDDp/a+g6mRI2iJPnd3sVZzNSp\r\nllpbDsqmqM8BLmQnvZXxFasvBQu/xe4KzFnrU0XQDl+4wdgqhLZHhJUVgauS\r\nSMyuMdPvtmD7srGIEU7cvWkc2IwCwfJqBy3qcjAbotCeNztnSKm+A/HZC/iK\r\n1oU0LIzwma+hDnpF56wVz6AfJp/HxmG/WhPXRt60UzPVMLd7jxG6ft1KLXCb\r\nhOCo2/QBU9burqLDMlm0CylOP0chyqX7jgiq1521qDk2eFVj13Dg+UIGXyQj\r\nqmoETDFJ6gi6883U9NUY//TE3ckEgGlAO0cvl9ch/BTRV75l06lB8zqz/Klx\r\nuMmJ/1JhrdQXx+aPfxyjkz3A/e5icNk+0eVBeM07PjQEPOEOAQ7B1ICAFD9q\r\nIKw54h/PbNgnqc86rZ79loJ+7ObY9JSgpxM=\r\n=GypL\r\n-----END PGP SIGNATURE-----\r\n","size":2479,"noattachment":false,"key":"/copy-text-to-clipboard/-/copy-text-to-clipboard-3.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/copy-text-to-clipboard_3.1.0_1678522767025_0.5409680621085431"},"_hasShrinkwrap":false,"readme":"# copy-text-to-clipboard\n\n> Copy text to the clipboard in modern browsers *(0.2 kB)*\n\n[Try it out!](https://jsfiddle.net/sindresorhus/6406v3pf/)\n\n## Comparison\n\n- This module: **0.2 kB**\n- [`clipboard.js`](https://github.com/zenorocha/clipboard.js): 3.4 kB\n\n## Install\n\n```sh\nnpm install copy-text-to-clipboard\n```\n\n## Usage\n\n```js\nimport copy from 'copy-text-to-clipboard';\n\nbutton.addEventListener('click', () => {\n\tcopy('🦄🌈');\n});\n```\n\n## API\n\n### copy(text, options?)\n\nCopy `text` to the clipboard.\n\nReturns a `boolean` of whether it succeeded to copy the text.\n\nMust be called in response to a user gesture event, like `click` or `keyup`.\n\n#### options\n\nType: `object`\n\n##### target\n\nType: `HTMLElement`\\\nDefault: `document.body`\n\nSpecify a DOM element where the temporary, behind-the-scenes `textarea` should be appended, in cases where you need to stay within a focus trap, like in a modal.\n\n## Related\n\n- [clipboardy](https://github.com/sindresorhus/clipboardy) - Access the system clipboard (copy/paste) in Node.js\n","publish_time":1678522767203,"_cnpm_publish_time":1678522767203,"dist-tags":{"latest":"3.2.2"}}