Skip to content

@tauri-apps/plugin-clipboard-manager

Read and write to the system clipboard.

function clear(): Promise<void>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/guest-js/index.ts#L155

Clears the clipboard.

Platform-specific

  • Android: Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.

Promise<void>

import { clear } from '@tauri-apps/plugin-clipboard-manager';
await clear();

2.0.0


function readImage(): Promise<Image>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/guest-js/index.ts#L105

Gets the clipboard content as Uint8Array image.

Platform-specific

  • Android / iOS: Not supported.

Promise<Image>

A promise resolving to the clipboard contents as an Image.

import { readImage } from '@tauri-apps/plugin-clipboard-manager';
const clipboardImage = await readImage();
const blob = new Blob([await clipboardImage.rgba()], { type: 'image' })
const url = URL.createObjectURL(blob)

2.0.0


function readText(): Promise<string>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/guest-js/index.ts#L50

Gets the clipboard content as plain text.

Promise<string>

A promise resolving to the clipboard contents as plain text.

import { readText } from '@tauri-apps/plugin-clipboard-manager';
const clipboardText = await readText();

2.0.0


function writeHtml(html, altText?): Promise<void>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/guest-js/index.ts#L134

  • Writes HTML or fallbacks to write provided plain text to the clipboard.

Platform-specific

  • Android / iOS: Not supported.
Parameter Type Description
html string The HTML markup to write to the clipboard.
altText? string The plain text fallback written alongside the HTML, used by targets that cannot render it.

Promise<void>

A promise indicating the success or failure of the operation.

import { writeHtml } from '@tauri-apps/plugin-clipboard-manager';
await writeHtml('<h1>Tauri is awesome!</h1>', 'plaintext');
// The following will write "<h1>Tauri is awesome</h1>" as plain text
await writeHtml('<h1>Tauri is awesome!</h1>', '<h1>Tauri is awesome</h1>');
// we can read html data only as a string so there's just readText(), no readHtml()
assert(await readText(), '<h1>Tauri is awesome!</h1>');

2.0.0


function writeImage(image): Promise<void>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/guest-js/index.ts#L79

Writes image buffer to the clipboard.

Platform-specific

  • Android / iOS: Not supported.
Parameter Type Description
image | string | Image | ArrayBuffer | Uint8Array<ArrayBufferLike> | number[] The image to write, as a path, raw RGBA bytes, or an existing Image.

Promise<void>

A promise indicating the success or failure of the operation.

import { writeImage } from '@tauri-apps/plugin-clipboard-manager';
const buffer = [
// A red pixel
255, 0, 0, 255,
// A green pixel
0, 255, 0, 255,
];
await writeImage(buffer);

2.0.0


function writeText(text, opts?): Promise<void>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/guest-js/index.ts#L30

Writes plain text to the clipboard.

Parameter Type Description
text string The plain text to write to the clipboard.
opts? { label?: string; } Additional configuration for the write operation.
opts.label? string A label describing the copied content. Android only, ignored on other platforms.

Promise<void>

A promise indicating the success or failure of the operation.

import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
await writeText('Tauri is awesome!');
assert(await readText(), 'Tauri is awesome!');

2.0.0


© 2026 Tauri Contributors. CC-BY / MIT