@axetroy/react-clipboard

2.0.0 • Public • Published

react-clipboard

clipboard wrapper component for react

Online demo

Install

yarn add react          # requirement
yarn add clipboard      # requirement
yarn add @axetroy/react-clipboard

Usage

import { Component } from "react";
import ReactClipboard from "@axetroy/react-clipboard";

class App extends Component {
  render() {
    return (
      <div>
        <ReactClipboard
          value={"you will copy me!"}
          onSuccess={() => {
            console.log("copy success");
          }}
          onError={() => {
            console.error("copy error");
          }}
        >
          <input type="button" value="Click me & copy that." />
        </ReactClipboard>
      </div>
    );
  }
}

Props

  • value: string

    any string you want to copy

  • onSuccess: function

    success callback

  • onError: function

    error callback

Run the Demo

git clone https://github.com/axetroy/react-clipboard.git
yarn
yarn start

License

The MIT License

Package Sidebar

Install

npm i @axetroy/react-clipboard

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

174 kB

Total Files

14

Last publish

Collaborators

  • axetroy