@tauri-apps/plugin-clipboard-manager
Read and write to the system clipboard.
function clear(): Promise<void>Clears the clipboard.
- 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>Gets the clipboard content as Uint8Array image.
- Android / iOS: Not supported.
Promise<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>Gets the clipboard content as plain text.
Promise<string>
import { readText } from '@tauri-apps/plugin-clipboard-manager';const clipboardText = await readText();2.0.0
function writeHtml(html, altText?): Promise<void>- Writes HTML or fallbacks to write provided plain text to the clipboard.
- Android / iOS: Not supported.
| Parameter | Type | 
|---|---|
| html | string | 
| altText? | string | 
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 textawait 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>Writes image buffer to the clipboard.
- Android / iOS: Not supported.
| Parameter | Type | 
|---|---|
| image | | string|number[] |ArrayBuffer|Uint8Array<ArrayBufferLike> |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>Writes plain text to the clipboard.
| Parameter | Type | 
|---|---|
| text | string | 
| opts? | object | 
| opts.label? | string | 
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
© 2025 Tauri Contributors. CC-BY / MIT