Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
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.67/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.