Saltearse al contenido
Tauri

Portapapeles

Lee y escribe en el portapapeles del sistema utilizando el plugin de portapapeles.

Plataformas compatibles

This plugin requires a Rust version of at least 1.77.2

Platform Level Notes
windows
linux
macos
android

Only plain-text content support

ios

Only plain-text content support

Configuración

Instala el plugin de portapapeles para comenzar.

Usa el gestor de paquetes de tu proyecto para añadir la dependencia:

npm run tauri add clipboard-manager

Uso

El plugin de portapapeles está disponible tanto en JavaScript como en Rust.

import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';
// cuando uses `"withGlobalTauri": true`, deberías usar
// const { writeText, readText } = window.__TAURI__.clipboardManager;
// Escribe contenido al portapapeles
await writeText('¡Tauri es increíble!');
// Leer contenido del portapapeles
const content = await readText();
console.log(content);
// Imprime "¡Tauri es increíble!" en la consola

Default Permission

No features are enabled by default, as we believe the clipboard can be inherently dangerous and it is application specific if read and/or write access is needed.

Clipboard interaction needs to be explicitly enabled.

This default permission set includes the following:

Permission Table

Identifier Description

clipboard-manager:allow-clear

Enables the clear command without any pre-configured scope.

clipboard-manager:deny-clear

Denies the clear command without any pre-configured scope.

clipboard-manager:allow-read-image

Enables the read_image command without any pre-configured scope.

clipboard-manager:deny-read-image

Denies the read_image command without any pre-configured scope.

clipboard-manager:allow-read-text

Enables the read_text command without any pre-configured scope.

clipboard-manager:deny-read-text

Denies the read_text command without any pre-configured scope.

clipboard-manager:allow-write-html

Enables the write_html command without any pre-configured scope.

clipboard-manager:deny-write-html

Denies the write_html command without any pre-configured scope.

clipboard-manager:allow-write-image

Enables the write_image command without any pre-configured scope.

clipboard-manager:deny-write-image

Denies the write_image command without any pre-configured scope.

clipboard-manager:allow-write-text

Enables the write_text command without any pre-configured scope.

clipboard-manager:deny-write-text

Denies the write_text command without any pre-configured scope.


© 2025 Tauri Contributors. CC-BY / MIT