Plugin EcosystemSystem & OS
Clipboard
Read from and write to the system clipboard securely.
The Clipboard plugin enables your application to securely read text from and write text to the system's native clipboard.
Installation
npm install @easycord/clipboardAPI Reference
writeText(text: string)
Writes the specified text to the system clipboard.
import { Clipboard } from '@easycord/clipboard';
import { useCallback } from 'react';
export function CopyButton({ textToCopy }: { textToCopy: string }) {
const handleCopy = useCallback(async () => {
try {
await Clipboard.writeText(textToCopy);
alert('Copied to clipboard!');
} catch (error) {
console.error('Clipboard write failed', error);
}
}, [textToCopy]);
return <button onClick={handleCopy}>Copy Share Link</button>;
}readText()
Reads the current text content from the clipboard.
const content = await Clipboard.readText();
console.log('Pasted content:', content);