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

Peer dependencies