Developer
On this page

Clipboard API

Read text from and write text to the system clipboard.

The ctx.sdk.clipboard surface reads text from and writes text to the system clipboard.

Scope required: clipboard:read (read) and clipboard:write (write)

Usage

Call ctx.sdk.clipboard inside a method’s run body:

import { defineMethod } from "@rightplace/applet-sdk/v2";

export default defineMethod({
  async run(_params, ctx) {
    const text = await ctx.sdk.clipboard.read();
    await ctx.sdk.clipboard.write("https://example.com");
  },
});

read resolves to the current clipboard text. write takes a single string and replaces the clipboard contents.

Notes

  • Declare clipboard:read for read and clipboard:write for write in applet.json::scopes[]. Each call needs its matching scope.
  • Both operations handle text only.
  • Both return a Promise; await before the method returns.