1.0.4 • Published 7 years ago

react-clipboard2 v1.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

react-clipboard2

Component to allow the user to easily copy text.

Install

npm install react-clipboard2 --save

Usage

var React = require("react");
var ReactDOM = require("react-dom");
var Clipboard = require("react-clipboard2");

var App = React.createClass({

  render: function() {
    return (
      <div>
        <Clipboard  onFail={handleFail.bind(this)}  onCopy={handleCopy.bind(this)} text="this text will be copyed">
            <button>Click here to copy</button>
        </Clipboard>
      </div>
    );
  },

  handleCopy : function(text) {
    alert("copied: " + text);
  }

  handleFail: function () {
    alert('failed');
  }

});

ReactDOM.render(
  <App />,
  document.querySelector("#app")
);
1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago