ClipboardTrigger is a facet that allows a user to copy text from a field to the clipboard.

Component’s XML-name: clipboardTrigger.


ClipboardTrigger is defined in the facets element of the screen XML descriptor and has the following attributes:

1. input - defines id of the component from which the text content will be copied. It is possible to associate the ClipboardTrigger with the following components:

2. button - defines id of the Button that triggers the copying.

With the help of isSupportedByWebBrowser() method you can check whether the user’s browser supports copying or not.

Usage example:

<window xmlns=""
        <clipboardTrigger id="clipboardTrigger"
        <hbox spacing="true">
            <maskedField id="maskedField"
                         caption="Phone number"
                         mask="(###) ###-##-##"/>
            <button id="btn"
private Notifications notifications;
private ClipboardTrigger clipboardTrigger;

public void onBtnClick(Button.ClickEvent event) {
    if (clipboardTrigger.isSupportedByWebBrowser()) {
                .withCaption("Phone number was copied to clipboard")
    } else {
                .withCaption("The phone number is not copied, because your " +
                        "browser does not support this functionality")

Events and Handlers

To generate a handler stub in Jmix Studio, select the facet in the screen descriptor XML or in the Component Hierarchy panel and use the Handlers tab of the Component Inspector panel.

Alternatively, you can use the Generate Handler button in the top panel of the screen controller.


This event fires when the user clicks on the button related to ClipboardTrigger and has the following methods:

  • isSuccess() - returns true if the text content was successfully copied to the client-side clipboard.

  • getSource() - returns the object of ClipboardTrigger on which the event initially occurred.

public void onClipboardTriggerCopy(ClipboardTrigger.CopyEvent event) {
    if (event.isSuccess()) {
                .withCaption("Text was successfully copied to clipboard")
    } else {
                .withCaption("Something went wrong during copying")

Programmatic registration of the event handler: use the addCopyListener() facet method.

All XML Attributes

You can view and edit attributes applicable to the facet using the Component Inspector panel of the Studio’s Screen Designer.