arya-blue
luna-amber
luna-blue
luna-green
luna-pink
nova-dark
nova-light
saga-blue
vela-blue
Clipboard
Clipboard is used to copy/cut text to the OS clipboard without the need for Flash.

Clipboard can have the text="PrimeFaces Rocks!" set specifically or it can be pointed at a text component using target="".

Clipboard can be used in menu options too...just right click the background to show the Context Menu.
Copy
Cut
Right click me to view the menu options!
Source

<h:panelGrid columns="4">
        <h:outputText value="Copy"/>
        <p:inputText id="txtCopy" value="#{clipboardController.copyInput}"/>
        <p:commandButton id="btnCopy" value="Copy" icon="pi pi-copy"/>
        <pe:clipboard id="clipCopy" trigger="btnCopy" action="copy" target="txtCopy">
            <p:ajax event="success" listener="#{clipboardController.successListener}"/>
            <p:ajax event="error" listener="#{clipboardController.errorListener}"/>
        </pe:clipboard>

        <h:outputText value="Cut"/>
        <p:inputText id="txtCut" value="#{clipboardController.cutInput}"/>
        <p:commandButton id="btnCut" value="Cut" icon="pi pi-clipboard"/>
        <pe:clipboard id="clipCut" trigger="btnCut" action="cut" target="txtCut">
            <p:ajax event="success" listener="#{clipboardController.successListener}"/>
            <p:ajax event="error" listener="#{clipboardController.errorListener}"/>
        </pe:clipboard>
    </h:panelGrid>

    <h:panelGroup layout="block" style="text-align:left;margin:10px;">
        <p:commandButton id="btnAjaxCopy" value="Ajax Copy" icon="pi pi-copy" onclick="return false;"/>
        <pe:clipboard id="clipAjax" trigger="btnAjaxCopy" action="copy" text="#{clipboardController.lineBreaks}">
            <p:ajax event="success" listener="#{clipboardController.successListener}"/>
            <p:ajax event="error" listener="#{clipboardController.errorListener}"/>
        </pe:clipboard>

        <p:button id="btnNonAjax" value="Non-Ajax Copy" icon="pi pi-copy" href="#"/>
        <pe:clipboard id="clipNonAjax" trigger="btnNonAjax" action="copy" text="PrimeFaces Clipboard Rocks Without Ajax!"
                      onsuccess="alert('Action: ' + this.action + ' Text:' + this.text);"
                      onerror="alert('Action: ' + this.action + ' FAILED!');"/>
    </h:panelGroup>

    <h:panelGroup layout="block" style="text-align:left;margin:10px;">
        <h:outputText id="lblRightClick">Right click me to view the menu options!</h:outputText>

        <p:contextMenu>
            <p:menuitem id="mnuCopy" value="Copy" url="javascript:void(0);" icon="pi pi-copy"/>
        </p:contextMenu>

        <pe:clipboard id="clipContextCopy" trigger="mnuCopy" action="copy" text="#{clipboardController.copyInput}">
            <p:ajax event="success" listener="#{clipboardController.successListener}"/>
            <p:ajax event="error" listener="#{clipboardController.errorListener}"/>
        </pe:clipboard>
    </h:panelGroup>
            
Components and more
Use Cases
Documentation pe:clipboard
Attributes (move mouse over the names to see data types)
Name Description
actionClipboard action: 'copy' or 'cut'.Default is copy.
bindingAn EL expression referring to a server side UIComponent instance in a backing bean.Default is generated.
idUnique identifier of the component in a namingContainer.Default is generated.
onerrorClient-side callback when the copy/cut action fails.
onsuccessClient-side callback when the copy/cut action succeeds.
renderedBoolean value to specify the rendering of the component, when set to false component will not be rendered.Default is true.
targetSearch expression for the element whose content is copied/cut.
textText to copy when no target is specified.Default is PrimeFaces Rocks!.
triggerSearch expression for the element that triggers the clipboard action.
widgetVarName of the client side widget.
PrimeFaces Extensions Showcase - © 2011-2025,PrimeFaces: 16.0.0-SNAPSHOT,PrimeFaces Extensions: 16.0.0-SNAPSHOT,JSF: Apache MyFaces Core 4.0 - Impl 4.0.3,Server: Apache Tomcat (TomEE)/10.1.52 (10.1.4),Build time: 2026-03-05 14:30