A simple hook to copy text from a given HTML element to your clipboard with copy-to-clipboard library.

Install and import

yarn add @welcome-ui/utils.copy react react-dom styled-components
import { useCopyText } from '@welcome-ui/utils.copy'

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


Peer dependencies