Navigator

Browser navigator helpers.

copyTextToClipboard

Copy text to the clipboard. Returns a promise that resolves when the text is copied.

import { copyTextToClipboard } from '@cc-heart/utils-client'

await copyTextToClipboard('hello')

Demo

Type something and copy it:

Loading...
Tip

Clipboard access requires a secure context (HTTPS or localhost) and a user gesture — the demo button satisfies both.