Skip to content

pasteFromClipboard()

pasteFromClipboard(): Promise<string>

Defined in: src/utils/domUtils.ts:100

Retrieves text from the clipboard.

This function uses the Clipboard API to read text from the clipboard. If an error occurs, it returns an empty string.

Returns

Promise<string>

A promise that resolves to the text from the clipboard, or an empty string if an error occurs.

Example

tsx
const text = await pasteFromClipboard();
console.log(text);

Released under the MIT License.