Hooks

useClipboard

Publisher

cermuel

50 hooks published

More from this publisher

useClipboard

Copies and reads clipboard content.

useClipboard.tsx
import { useClipboard } from "@cermuel/hooks/react";export function useClipboardExample() {  const { text, copy } = useClipboard();  return <button type="button" onClick={() => void copy("Hello")}>{text || "Copy"}</button>;}

Props

Param
Type
Default Value

No props for this hook

Returns

{ text: string; supported: boolean; error: Error | null; copy: (value: string) => Promise<boolean>; read: () => Promise<string>; }