Skip to content

@tauri-apps/plugin-clipboard-manager

Read and write to the system clipboard.

function clear(): Promise<void>;

Defined in: plugins/clipboard-manager/guest-js/index.ts:155

Clears the clipboard.

Platform-specific

  • Android: Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.
import { clear } from '@tauri-apps/plugin-clipboard-manager';
await clear();

Promise<void>

2.0.0


function readImage(): Promise<Image>;

Defined in: plugins/clipboard-manager/guest-js/index.ts:105

Gets the clipboard content as Uint8Array image.

Platform-specific

  • Android / iOS: Not supported.
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)

Promise<Image>

A promise resolving to the clipboard contents as an Image.

2.0.0


function readText(): Promise<string>;

Defined in: plugins/clipboard-manager/guest-js/index.ts:50

Gets the clipboard content as plain text.

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

Promise<string>

A promise resolving to the clipboard contents as plain text.

2.0.0


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

Defined in: plugins/clipboard-manager/guest-js/index.ts:134

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

Platform-specific

  • Android / iOS: Not supported.
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>');
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.

2.0.0


function writeImage(image: string | Image | ArrayBuffer | Uint8Array | number[]): Promise<void>;

Defined in: plugins/clipboard-manager/guest-js/index.ts:79

Writes image buffer to the clipboard.

Platform-specific

  • Android / iOS: Not supported.
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);
Parameter Type Description
image | string | Image | ArrayBuffer | Uint8Array | 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.

2.0.0


function writeText(text: string, opts?: {
label?: string;
}): Promise<void>;

Defined in: plugins/clipboard-manager/guest-js/index.ts:30

Writes plain text to the clipboard.

import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
await writeText('Tauri is awesome!');
assert(await readText(), 'Tauri is awesome!');
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.

2.0.0


© 2026 Tauri Contributors. CC-BY / MIT