Circle V2 API Docs
    Preparing search index...

    Function useCopyToClipboard

    • Parameters

      • __namedParameters: CopyToClipboardProps = {}

      Returns {
          copyToClipboard: (
              text: string | number,
              clipboardItemType?: ClipboardItemType,
          ) => Promise<boolean>;
          isCopied: boolean;
      }

      • copyToClipboard: (
            text: string | number,
            clipboardItemType?: ClipboardItemType,
        ) => Promise<boolean>

        Copies text to the clipboard, preferring a rich ClipboardItem write so text/html formatting is preserved. Resolves to true on success.

        navigator.clipboard.write() requires the clipboard-sanitized-write permission, which some embedded environments deny (notably the Electron desktop app, where it surfaced as an unhandled NotAllowedError). When the rich write is rejected we fall back to writeText, which is not permission-gated — formatting is lost but the copy still lands. Success side effects (the onCopy callback and the "copied" state) only fire once a write actually succeeds, so callers never show a false confirmation.

      • isCopied: boolean