useCopyText
A simple hook to copy text from a given HTML element to your clipboard with copy-to-clipboard library.
Install and import
Copy the content of an element
Copy the content from another HTML element by creating a ref
and passing it to useCopyText
.
You can pass a timeout
value (in milliseconds) to "reset" the copied
value.
This text will be copied
Copy a string
You can also copy a simple string
Dependencies
- - copy-to-clipboard^3.2.0
Peer dependencies
- - react^16.10.2 || ^17.0.1
- - react-dom^16.10.2 || ^17.0.1
- - styled-components^5.0.0