Clipboard
Copy, paste and clear text, with a paste() that follows the system clipboard.
janelkit-desktop System services: native file and message dialogs, and the clipboard. It adds no interface controls. pip install janelkit-desktopCopy, paste and clear
clipboard.copy(text) places text on the system clipboard, clipboard.paste() returns the current text (an empty string when there is none), and clipboard.clear() empties it. paste() is reactive: used in a template, it updates when the clipboard changes, including changes made by other applications. Only text is supported, and every function needs a running application.
<!-- Partial template; the script imports clipboard from janelkit_desktop. -->
<text>On the clipboard: {clipboard.paste()}</text>
<button on:click={clipboard.copy(order_id)}>Copy the order number</button>CopyFragment · Add it to an existing component; it is not a complete file.
Or let the user select the text
For text the user may want to copy by hand, such as an order number or an error message, the core already has <text selectable>: it is selected with the mouse or Ctrl+A and copied with Ctrl+C, without this package.
Learn moreBuilt-in elements ↗
English documentation based on the JanelKit source. For additional details, browse the source docs ↗.