copy-text-to-clipboard

WebJar for copy-text-to-clipboard

License

License

MIT
Categories

Categories

CLI User Interface
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

copy-text-to-clipboard
Last Version

Last Version

2.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

copy-text-to-clipboard
WebJar for copy-text-to-clipboard
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/copy-text-to-clipboard

Download copy-text-to-clipboard

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/copy-text-to-clipboard/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>copy-text-to-clipboard</artifactId>
    <version>2.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/copy-text-to-clipboard/
implementation 'org.webjars.npm:copy-text-to-clipboard:2.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/copy-text-to-clipboard/
implementation ("org.webjars.npm:copy-text-to-clipboard:2.2.0")
'org.webjars.npm:copy-text-to-clipboard:jar:2.2.0'
<dependency org="org.webjars.npm" name="copy-text-to-clipboard" rev="2.2.0">
  <artifact name="copy-text-to-clipboard" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='copy-text-to-clipboard', version='2.2.0')
)
libraryDependencies += "org.webjars.npm" % "copy-text-to-clipboard" % "2.2.0"
[org.webjars.npm/copy-text-to-clipboard "2.2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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

const copy = require('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

Versions

Version
2.2.0
2.1.1