JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 145
  • Score
    100M100P100Q92242F
  • License MIT

clipboardjs copy component for react

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 to clipboard.js attribut data-clipboard-text.

  • target - string React component will copy target element content. Corresponding to clipboard.js attribut data-clipboard-target.

  • action - string React component action. Corresponding to clipboard.js attribut data-clipboard-action. But only support copy(default: 'copy').

  • selection - boolean Setting whether to clear the copy selected. Corresponding to clipboard.js event e.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