0.0.6 • Published 6 years ago

react-copy-button-wrapper v0.0.6

Weekly downloads
233
License
MIT
Repository
github
Last release
6 years ago

react-copy-button-wrapper

Component Wrapper for Copy to Clipboard Button with React

Usage

% npm install react-copy-button-wrapper

<ReactCopyButtonWrapper text='test'>
  <button>Copy</button>
</ReactCopyButtonWrapper>

Example

Please look at /example directory.

Demo page is here: http://pastak.github.io/react-copy-button-wrapper/example/example.html

How works

Modern Browsers

Firefox, Chrome, Opera, IE9+ works with Selection API and execCommand

Safari

It works with react-zeroclipboard which is relies on zeroclipboard.

It depends on Flash!!!!!!!!!!!!

< IE9

It works with window.clipboardData.setData

Motivation

Clipboard API was comming to modern browsers and clipboard.js is great solution. However Safari and old browsers don't support yet.

Zeroclipboard is solution for all browsers but it's not better because depends on flash...

And some react components for copy buttons ( for example react-copy-to-clipboard react-clipboard ) have only support for modern browsers.

This component's goal is that works with modern browsers and safari and old-IE.