use-clipboard
Copy to clipboard with feedback timeout
Source
Docs
PackageIcon
Usage
The use-clipboard hook provides a simple way to copy text to the clipboard,
track the copied state, handle errors, and reset the state after a given timeout.
It uses the navigator.clipboard.writeText API under the hood.
Limitations
Due to security reasons, the use-clipboard hook will not work in iframes and may not work with local files opened with the file:// protocol
(the hook will work fine with local websites that are using the http:// protocol). You can learn more about navigator.clipboard here.
Definition
Exported types
The UseClipboardOptions and UseClipboardReturnValue types are exported from the @mantine/hooks package;
you can import them in your application: