Clipboard API

To Share and +4 nLEARNs

import Tabs from ‘@theme/Tabs’;
import TabItem from ‘@theme/TabItem’;

The VM implements a clipboard API that works like Mozilla’s Clipboard, providing write access to the contents of the system clipboard. The Clipboard API can be used to implement cut, copy, and paste features within a web application.

For extra safety, the VM has isTrusted as part of the stack. This allows to verify if the action was part of the stack originating from the isTrusted user’s event.



The Clipboard interface’s writeText() copies the specified text string to the system clipboard.

The event requires for the page to be in transient state (explicit user’s click).


param required type description
text required string data to be copied to the clipboard.


return (


// Copy “HelloWorld!” to clipboard

Generate comment with AI 2 nL
Scroll to Top
Report a bug👀