1.2.1 • Published 6 years ago

react-copy v1.2.1

Weekly downloads
130
License
MIT
Repository
github
Last release
6 years ago

Simplistic copy-to-clipboard component Build Status Dependencies

Works by selecting a string given as a prop and then copies it. Almost no dependencies.

Usage

npm install react-copy --save

or

yarn add react-copy
import Copy from 'react-copy';

...

<Copy textToBeCopied={this.state.text}>
    <button>
      Copy the text please please
    </button>
</Copy>

Properties

textToBeCopied

Type: PropTypes.string.isRequired

The text that should be copied on button click

children

Type: PropTypes.element.isRequired

Exactly one child is required as a click handler for copying, e.g. a button

onCopy

Type: PropTypes.func

A callback function called when copy function is called

style

Type: PropTypes.object

Optional style object

Example

For a real world use-case checkout a demo (https://github.com/hamsterbacke23/movierater)

Alternatives to this component

Also check out

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago