# ui-copy-button

> A simple copy button for React.

Latest version **0.1.0** (published 2019-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install ui-copy-button
pnpm add ui-copy-button
yarn add ui-copy-button
bun add ui-copy-button
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-04-09 |
| First published | 2019-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Armando Canals |
| Maintainers | armandocanals |

## Links

- npm: https://www.npmjs.com/package/ui-copy-button
- Repository: https://github.com/armandocanals/ui-copy-button
- Homepage: https://github.com/armandocanals/ui-copy-button#readme
- Issues: https://github.com/armandocanals/ui-copy-button/issues
- npm.io page: https://npm.io/package/ui-copy-button

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.8.6

## Recent versions

- 0.1.0 (latest) — 2019-04-09

## README

# ui-copy-button
A (really) simple component to copy text from a selector or from props.

## Required Props:
| Props  | Description |
| ------------- | ------------- |
| textToCopy | (String) text to copy to clipboard - required if `elementId` prop is not set |
| elementId  | (String) DOM ID of element on the page - required if `textToCopy` prop is not set  |

## Optional Props:
| Props  | Description |
| ------------- | ------------- |
| className | (String) custom class for button |
| actionText  | (String) text to display in the button when copy is successful'  |
| onCopied  | (Function) run when copy is successful |

## Usage Examples
### Selecting text from an element:
```
<CopyButton elementId="root" />
```

### Selecting text from props:
```
<CopyButton textToCopy="Copied from props!" />
```

### Set a custom class name:
```
<CopyButton className="btn copy" textToCopy="Copied from props!" />
```

### Override button text:
```
<CopyButton elementId="root">I'm a copy button</CopyButton>
```

### Call a function when a copy is successful:
```
<CopyButton textToCopy="Text copied from props!" onCopied={someCustomAction} />
```

---
_Source: https://npm.io/package/ui-copy-button · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
