Understanding MenuModel
Many of the PrimeFaces menu components such as Menu, TieredMenu, SlideMenu, MegaMenu, MenuBar, TabMenu, PanelMenu, and Breadcrumb are backed by the org.primefaces.model.MenuModel
instance, and can also be created in a declarative way using the same <p:menuitem>
and <p:submenu>
elements.
Building menus declaratively
We can create menus declaratively using the <p:menuitem>
and <p:submenu>
elements. The <p:submenu>
element can be used to group menu options, and submenus can be nested inside other submenus.
The <p:menuitem>
element provides the following options to customize its behavior:
value
: Label of the MenuItem.icon
: Path of the MenuItem image.title
: Advisory tooltip information.disabled
: Disables the MenuItem component. Default isfalse
.target
: Target type of the URL navigation.url
: URL to be navigated when MenuItem is clicked.outcome
: Navigation case outcome.action
: Action to be invoked when MenuItem is clicked.actionListener
...