useCopyToClipboard

A hook that copies text to the clipboard.

Installation

Install the following dependencies

Loading...

bash

API Reference

Input Params

ParamTypeDefaultDescription
timeoutnumber | undefined2000The timeout in milliseconds to reset the copied state. If undefined, the copied state will not be reset.
onCopy() => void | undefined-The callback function to be called when the text is copied to the clipboard.

Returned Props

PropTypeDefaultDescription
isCopiedbooleanfalseIndicates if the text has been copied to the clipboard.
copyToClipboard(value: string) => void-Copies the given text to the clipboard.