React hook that provides copy to clipboard functionality.
Installations
npm install react-use-clipboard
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
12.22.12
NPM Version
6.14.16
Score
93.9
Supply Chain
69.7
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (75.82%)
JavaScript (24.18%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
danoc
Download Statistics
Total Downloads
10,602,072
Last Day
8,177
Last Week
45,083
Last Month
200,556
Last Year
2,827,287
GitHub Statistics
MIT License
265 Stars
101 Commits
15 Forks
1 Watchers
4 Branches
6 Contributors
Updated on Nov 17, 2024
Bundle Size
2.61 kB
Minified
1.20 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.9
Package Id
react-use-clipboard@1.0.9
Unpacked Size
12.84 kB
Size
4.04 kB
File Count
13
NPM Version
6.14.16
Node Version
12.22.12
Total Downloads
Cumulative downloads
Total Downloads
10,602,072
Last Day
-0.3%
8,177
Compared to previous day
Last Week
1.5%
45,083
Compared to previous week
Last Month
34.2%
200,556
Compared to previous month
Last Year
-7.4%
2,827,287
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
📋 react-use-clipboard
A React Hook that provides copy to clipboard functionality.
Install
You can install react-use-clipboard
with NPM or Yarn.
1npm install react-use-clipboard
1yarn add react-use-clipboard
Usage
Here's how to use react-use-clipboard
:
1import useClipboard from "react-use-clipboard"; 2 3function App() { 4 const [isCopied, setCopied] = useClipboard("Text to copy"); 5 6 return ( 7 <button onClick={setCopied}> 8 Was it copied? {isCopied ? "Yes! 👍" : "Nope! 👎"} 9 </button> 10 ); 11}
You can reset the isCopied
value after a certain amount of time with the successDuration
option.
1import useClipboard from "react-use-clipboard";
2
3function App() {
4 const [isCopied, setCopied] = useClipboard("Text to copy", {
5 // `isCopied` will go back to `false` after 1000ms.
6 successDuration: 1000,
7 });
8
9 return (
10 <button onClick={setCopied}>
11 Was it copied? {isCopied ? "Yes! 👍" : "Nope! 👎"}
12 </button>
13 );
14}
This package only works in versions of React that support Hooks.

No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 1/8 approved changesets -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/danoc/react-use-clipboard/release.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/danoc/react-use-clipboard/release.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/danoc/react-use-clipboard/test.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/danoc/react-use-clipboard/test.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/danoc/react-use-clipboard/test.yml/main?enable=pin
- Info: 0 out of 5 third-party GitHubAction dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 26 are checked with a SAST tool
Reason
22 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-c59h-r6p8-q9wc
- Warn: Project is vulnerable to: GHSA-g77x-44xx-532m
- Warn: Project is vulnerable to: GHSA-7gfc-8cq8-jh5f
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5
- Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp
- Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2.6
/10
Last Scanned on 2025-02-17
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-use-clipboard
use-clipboard-copy
Lightweight copy to clipboard hook for React
use-clipboard-api
📋useClipboardApi is a React Hook that consumes Web Clipboard API.
use-clippy
A React hook for reading from and writing to the clipboard.
react-use-copy-to-clipboard
this hook is needed to copy text to the clipboard when clicking on any element