Package Exports
- react-clipboardjs-copy
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-clipboardjs-copy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-clipboardjs-copy
A react copy component that based on clipboard.js
Installing
npm install --save react-clipboardjs-copy
Basic usage
import React from 'react';
import {ReactClipboard} from 'react-clipboardjs-copy'
import './App.css';
export default class App extends React.Component {
render () {
return (
<div className="App">
<section className="app-item">
<div className="app-item-desc">copy text</div>
<ReactClipboard text='copy text'
onSuccess={(e) => console.log(e)}
onError={(e) => console.log(e)}>
<button>Copy</button>
</ReactClipboard>
</section>
</div>
)
}
}
Options(props)
text
- string React component will copy content. Corresponding toclipboard.js
attributdata-clipboard-text
.target
- string React component will copy target element content. Corresponding toclipboard.js
attributdata-clipboard-target
.action
- string React component action. Corresponding toclipboard.js
attributdata-clipboard-action
. But only support copy(default: 'copy').selection
- boolean Setting whether to clear the copy selected. Corresponding toclipboard.js
evente.clearSelection()
. (default: true)onSuccess
- function Copy success callback.onError
- function Copy error callback.
Developing
git clone git@github.com:freeshineit/react-clipboardjs-copy.git
cd react-clipboardjs-copy
npm install
npm run dev
License
MIT © Shine Shao