• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

MenuButton

MenuButton groups multiple items in a popup.

MenuButton Tag Documentation

MenuButton displays different commands in a popup menu.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
appendTo String false @(body) Appends the overlay to the element defined by search expression.
ariaLabel String false The aria-label attribute is used to define a string that labels the current element for accessibility.
autoDisplay boolean false true Defines whether the first level of submenus will be displayed on mouseover or click event.
buttonIcon String false Icon class to display in place of the button label. If specified, the icon will be shown instead of the value (label).
buttonStyle String false Style of the button
buttonStyleClass String false Style class of the button
collision String false flip Applied only when overlay is set to true. When the overlay menu overflows the window in some direction, move it to an alternative position. Supported values are flip, fit, flipfit and none. See https://api.jqueryui.com/position/ for more details. When the body of your layout does not scroll, you may also want to set the option maxHeight.
delay int false 0 Delay in milliseconds before displaying the submenu.
dir String false ltr Defines text direction, valid values are ltr and rtl.
disableOnAjax boolean false true If true, the button will be disabled during Ajax requests triggered by its menu items.
disabled boolean false false Disables or enables the button.
hideDelay int false 0 Delay in milliseconds before hiding the submenu, if 0 not hidden until document.click().
icon String false Icon of the menu button.
iconPos String false left Position of the icon, valid values are left and right.
maxHeight String false The maximum height of the menu. May be either a number (such as 200), which is interpreted as a height in pixels. Alternatively, may also be a CSS length such as 90vh or 10em. Often used when overlay is set to true, but also works when it is set to false. Useful in case the body of your layout does not scroll, especially in combination with the collision property.
menuStyleClass String false Style class of the overlay menu element.
model MenuModel false MenuModel instance to create menus programmatically
showDelay int false 0 Delay in milliseconds before displaying the submenu. Default is 0 meaning immediate.
size String false Defines the size of the button, valid values are "small" and "large".
style String false Inline style of the component.
styleClass String false Style class of the component.
tabindex String false 0 Position of the element in the tabbing order.
title String false Advisory tooltip information.
toggleEvent String false Event to toggle the submenus, valid values are "hover" and "click".
value String false Label of the button
Loading...
Tag DocumentationNew DocumentationNew Documentation JSDoc

Usage


<div class="card">
    <h:form>
        <p:growl id="messages" showDetail="true"/>

        <h5 class="mt-0">Basic</h5>
        <p:menuButton value="Options">
            <p:menuitem value="Save (Non-Ajax)" action="#{menuView.save}" ajax="false" update="messages" icon="pi pi-save"/>
            <p:menuitem value="Update" action="#{menuView.update}" update="messages" icon="pi pi-refresh"/>
            <p:menuitem value="Delete" action="#{menuView.delete}" update="messages" icon="pi pi-times"/>
            <p:divider/>
            <p:menuitem value="Website" url="http://www.primefaces.org" icon="pi pi-external-link"/>
        </p:menuButton>

        <h5>Button style</h5>
        <p:menuButton value="Options" buttonStyleClass="ui-button-outlined" buttonStyle="border-radius: 0 1rem">
            <p:menuitem value="Save (Non-Ajax)" action="#{menuView.save}" ajax="false" update="messages" icon="pi pi-save"/>
            <p:menuitem value="Update" action="#{menuView.update}" update="messages" icon="pi pi-refresh"/>
            <p:menuitem value="Delete" action="#{menuView.delete}" update="messages" icon="pi pi-times"/>
            <p:divider/>
            <p:menuitem value="Website" url="http://www.primefaces.org" icon="pi pi-external-link"/>
        </p:menuButton>

        <h5>Ajax Disabling and Status Icon</h5>
        <p:menuButton value="Options">
            <p:menuitem value="Save" action="#{menuView.sleepAndSave}" update="messages" icon="pi pi-save"/>
            <p:menuitem value="Update" action="#{menuView.sleepAndUpdate}" update="messages" icon="pi pi-refresh"/>
            <p:menuitem value="Delete" action="#{menuView.sleepAndDelete}" update="messages" icon="pi pi-times"/>
        </p:menuButton>

        <h5>Button Icon</h5>
        <p:menuButton buttonIcon="pi pi-save" title="Options">
            <p:menuitem value="Save (Non-Ajax)" action="#{menuView.save}" ajax="false" update="messages" icon="pi pi-save"/>
            <p:menuitem value="Update" action="#{menuView.update}" update="messages" icon="pi pi-refresh"/>
            <p:menuitem value="Delete" action="#{menuView.delete}" update="messages" icon="pi pi-times"/>
            <p:divider/>
            <p:menuitem value="Website" url="http://www.primefaces.org" icon="pi pi-external-link"/>
        </p:menuButton>
        
        <h5>Sizes</h5>
        <p:menuButton value="Small" size="small" style="margin-right: 1em;">
            <p:menuitem value="Save" action="#{menuView.sleepAndSave}" update="messages" icon="pi pi-save"/>
            <p:menuitem value="Update" action="#{menuView.sleepAndUpdate}" update="messages" icon="pi pi-refresh"/>
            <p:menuitem value="Delete" action="#{menuView.sleepAndDelete}" update="messages" icon="pi pi-times"/>
        </p:menuButton>
        <p:menuButton value="Normal" style="margin-right: 1em;">
            <p:menuitem value="Save" action="#{menuView.sleepAndSave}" update="messages" icon="pi pi-save"/>
            <p:menuitem value="Update" action="#{menuView.sleepAndUpdate}" update="messages" icon="pi pi-refresh"/>
            <p:menuitem value="Delete" action="#{menuView.sleepAndDelete}" update="messages" icon="pi pi-times"/>
        </p:menuButton>
        <p:menuButton value="Large" size="large">
            <p:menuitem value="Save" action="#{menuView.sleepAndSave}" update="messages" icon="pi pi-save"/>
            <p:menuitem value="Update" action="#{menuView.sleepAndUpdate}" update="messages" icon="pi pi-refresh"/>
            <p:menuitem value="Delete" action="#{menuView.sleepAndDelete}" update="messages" icon="pi pi-times"/>
        </p:menuButton>
    </h:form>
</div>