Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clipboard-text

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipboard-text

Simple and small copy-text-to-the-clipboard-utility with IE11 support

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-14.29%
Maintainers
1
Weekly downloads
 
Created
Source

clipboard-text Build Status npm package

Simple and small copy-text-to-the-clipboard-utility with IE11 support

Installation

npm install clipboard-text

Usage

import copy from 'clipboard-text'

button.addEventListener('click', () => {
  copy('Hi there')
})

API

copy(text: string, parentElement?: Element): boolean

Copy text to the clipboard.

If the event triggering the copy functions comes from an element with a focus trap, like a Modal, you will need to provide a parentElement. By default, parentElement is set to body.

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.

  • copy-text-to-clipboard - Original package with no support for IE and no support for focus traps

License

MIT

Keywords

FAQs

Package last updated on 27 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc