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

clipboard-mini

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipboard-mini

Super tiny copy-to-clipboard JS library

  • 0.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

clipboard-mini

Super tiny copy-to-clipboard JS library. Only 1.34KB!

If you've come from clipboard.js and want a smaller package, you get pretty much the same here at half the cost (in KB).

No dependencies at all, no flash no nothing. Vanilla JS 🚀

How to use it

Import clipboard-mini into your project like any other module:

yarn add clipboard-mini

To start using it, you only need to give ClipboardMini a selector.

import ClipboardMini from 'clipboard-mini'

const clipbutton = new ClipboardMini('.js-clipboard')

<button class="btn js-clipboard">Copy</button>

You can target what to copy via attribute, which can be text or a selector:

  • data-clipboard-text: You will copy the text contained in th attribute to the clipboard
  • data-clipboard-target: A unique CSS selector (it will grab the first result available) from which to copy its contents.

Feedback

In order to let the user know something has been copied to the clipboard, the button label will change to Copied! for 2.5seconds, then revert to the original label.

Keywords

FAQs

Package last updated on 19 Jul 2019

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