@supunlakmal/hooks
Version:
A collection of reusable React hooks
16 lines (15 loc) • 595 B
TypeScript
interface UseClipboardReturn {
value: string | null;
error: Error | DOMException | null;
copy: (text: string) => Promise<void>;
paste: () => Promise<string>;
}
/**
* Custom hook for interacting with the system clipboard (copy and paste).
* Uses the modern asynchronous Clipboard API (`navigator.clipboard`).
*
* @param {UseClipboardOptions} [options] - Optional configuration options.
* @returns {UseClipboardReturn} An object containing the clipboard value, error state, and copy/paste functions.
*/
export declare const useClipboard: () => UseClipboardReturn;
export {};