Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/usehooks-ts.ts>useCopyToClipboard

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useCopyToClipboard
import { useCopyToClipboard } from "https://deno.land/x/netzo@0.5.63/deps/usehooks-ts.ts";

Custom hook for copying text to the clipboard.

Examples

// Usage of useCopyToClipboard hook const [copiedText, copyToClipboard] = useCopyToClipboard(); const textToCopy = 'Hello, world!';

// Attempt to copy text to the clipboard copyToClipboard(textToCopy) .then(success => { if (success) { console.log(Text "${textToCopy}" copied to clipboard successfully.); } else { console.error('Failed to copy text to clipboard.'); } });

Returns

[CopiedValue, CopyFn]

An tuple containing the copied text and a function to copy text to the clipboard.