https://github.com/axetroy/react-clipboard
clipboard wrapper component for react
https://github.com/axetroy/react-clipboard
clipboard react react-component wrapper-component
Last synced: 22 days ago
JSON representation
clipboard wrapper component for react
- Host: GitHub
- URL: https://github.com/axetroy/react-clipboard
- Owner: axetroy
- License: mit
- Created: 2017-05-03T18:57:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-08T12:44:29.000Z (about 6 years ago)
- Last Synced: 2025-02-15T05:15:31.807Z (3 months ago)
- Topics: clipboard, react, react-component, wrapper-component
- Language: JavaScript
- Homepage: https://axetroy.github.io/react-clipboard/
- Size: 420 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-clipboard
[clipboard](https://github.com/zenorocha/clipboard.js) wrapper component for react
[Online demo](https://axetroy.github.io/react-clipboard/)
## Install
```bash
yarn add react # requirement
yarn add clipboard # requirement
yarn add @axetroy/react-clipboard
```## Usage
```javascript
import { Component } from "react";
import ReactClipboard from "@axetroy/react-clipboard";class App extends Component {
render() {
return (
{
console.log("copy success");
}}
onError={() => {
console.error("copy error");
}}
>
);
}
}
```## Props
* value: string
any string you want to copy
* onSuccess: function
success callback
* onError: function
error callback
## Run the Demo
```bash
git clone https://github.com/axetroy/react-clipboard.git
yarn
yarn start
```### License
The [MIT License](https://github.com/axetroy/react-clipboard/blob/master/LICENSE)