3.2.0 • Published 2 years ago

copy-text-to-clipboard v3.2.0

Weekly downloads
144,382
License
MIT
Repository
github
Last release
2 years ago

copy-text-to-clipboard

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

Try it out!

Comparison

Install

npm install copy-text-to-clipboard

Usage

import copy from 'copy-text-to-clipboard';

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

API

copy(text, options?)

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.

options

Type: object

target

Type: HTMLElement\ Default: document.body

Specify 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.

Related

  • clipboardy - Access the system clipboard (copy/paste) in Node.js
@xcop/fr-generatordocz-theme-umi-yformfr-generator-enkbc-ui-cli-v2iot-platform-packagetest-fr-generator@bruceye/fr-generator-englishdocz-theme-keuitxmeta@go-ui/utils@everything-registry/sub-chunk-1380@pxwlab/docz-theme-katanasuper-fr-generatorsvelte-yagameswodax-docz-theme-umixiaodhuang-fr-generatorstong-uitest-trackingth-fr-generatorvitepress-rcvconsolevconsolelogsvconsole-exportvconsole-export-logsvconsole-fixed-sse-streamvoyajira-extension-scriptissue-reporter-webitdkjhit_chatkeepix-application-interfacekhulnasoft-apptracing-panelhypertrack-views-reacthypertrack-sdk-reactjshakan-doc-themegyf-fr-generatorlg-vtilslocation-tracking-testlimbo-toolsltt-fr-generatorkolojs@wenglx/fr-generator@xauth/react-lock@umijs/preset-dumi@types/copy-text-to-clipboard@vfusion/cli@vega/components@yingpengsha/axii-x6@zalastax/nolb-cop@zgfe/modules-sgak-generatoraxii-x6app-base-react@go-ui/demo-frame@hashicorp/octavotxgw-docusaurus-theme-openapi-docsudesign-uituns-component-themeuat-schema-generatortheme-openapi-writedocstrack-test-222trioslibutfsrb-ui-kitzart-clixxh-vuiyy-uizy-plugin-vconsolevue3-copyzl-generator@kyfe/ksui-cli@kyoung18/netlify-cms-core@ljm-editor/cli@log4brains/web@loview/cli-plugin-doc@lg-design/fr-generatormodule-editormypluginloloa-vant-clipear-radiosensesai-routerrobsonolv-library-testprometheus-copy-testsc-generatorsemi-uinetlify-cms-corepddui-cliplugin-loading-toolppdui-cliraccoon-cliresign-datepickersindresorhus.jssmartcontract-appreact-saasifyreact-saasify-chrisvxdgo-ui-demo-utils@papyrum/ui@papyrum/ui-docs@panda-dev/cli@nullbot/docusaurus-theme-nonepress@noyobo/vconsole
3.2.0

2 years ago

3.1.0

3 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago