react-copy-button-wrapper

Component Wrapper for Copy to Clipboard Button with React

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-copy-button-wrapper
910.0.66 years ago8 years agoMinified + gzip package size for react-copy-button-wrapper in KB

Readme

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.aspx)

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.