@capacitor/clipboard
The Clipboard API enables copy and pasting to/from the system clipboard.
Install
npm install @capacitor/clipboard
npx cap sync
Example
import { Clipboard } from '@capacitor/clipboard';
const writeToClipboard = async () => {
await Clipboard.write({
string: "Hello World!"
});
};
const checkClipboard = async () => {
const { type, value } = await Clipboard.read();
console.log(`Got ${type} from clipboard: ${value}`);
};
API
write(...)
write(options: WriteOptions) => Promise<void>
Write a value to the clipboard (the "copy" action)
| Param | Type |
|---|---|
options | |
Since: 1.0.0
read()
read() => Promise<ReadResult>