https://github.com/animify/usecopy
📋 A React hook to copy dynamic textual data.
https://github.com/animify/usecopy
clipboard copy hooks react reacthooks
Last synced: 7 months ago
JSON representation
📋 A React hook to copy dynamic textual data.
- Host: GitHub
- URL: https://github.com/animify/usecopy
- Owner: animify
- License: mit
- Created: 2019-05-13T16:16:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T09:20:46.000Z (about 3 years ago)
- Last Synced: 2025-05-12T21:48:36.643Z (8 months ago)
- Topics: clipboard, copy, hooks, react, reacthooks
- Language: JavaScript
- Homepage:
- Size: 315 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# useCopy 📋
A React Hook that provides an easy interface to copy textual data.
```js
import React from 'react';
import useCopy from 'use-copy';
function Count() {
const [copied, copy, setCopied] = useCopy("Text to copy");
const copyText = () => {
copy();
setTimeout(() => {
setCopied(false);
}, 3000);
};
return (
);
}
```
[Full example on Code Sandbox](https://codesandbox.io/s/101qo4m9n3)
## Install
```bash
# Yarn
yarn add use-copy
# NPM
npm install use-copy
```
## Features
- Feather light
- Pass dynamic text
- Easy interface
- Full Typescript support
- Uses the battle-tested [copy-to-clipboard](https://github.com/sudodoki/copy-to-clipboard)
## Prerequisites
⚠️ React hooks require `react` at version 16.7.0-alpha.0 or higher.
## Issues & suggestions
If you find any runtime issues or have any suggestions on how to improve the package please do open an [issue](https://github.com/animify/useCopy/issues)!
## License
[MIT License](LICENSE)