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

copy-button

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-button

Web component to copy target text/dom-node value to clipboard

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

<copy-button></copy-button>

A web-component that is not relying on Flash to copy stuff into the clipboard. Experience may vary, based on browser support, with downgrading to using prompt.

Installation

NPM

npm i --save copy-button after which you're good to use copy-button &

  • require it from your main file
  • add 'node_modules/copy-button/bundled.min.js' as script in your html

CDN

You can also use it from wzrd.in CDN and drop <script src='https://wzrd.in/standalone/copy-button@latest'></script> into your html

Usage

After having script ran, you're good to use <copy-button></copy-button> in your markup.

Inner content

If you're not specifying inner content, it would default to 'Click to copy to clipboard', otherwise provided content would be inserted into the button. Can use icons here, etc. See example

target-text

If you specify target-text attribute on button, provided value will be copied to clipboard. Example

target-element

If you specify target-element attribute on button, value or text of provided DOM node will be copied to clipboard (it will be retrieved using document.getElementById if value will be specified as #specifiedID or document.querySelectorAll in other cases). See examples

Under the hood

Built on top of document.registerElement polyfill & copy-to-clipboard

Keywords

FAQs

Package last updated on 11 Jan 2022

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