TabMenu is a menu component displaying menuitems as tabs.
<div class="card">
<h5 class="mt-0">Basic</h5>
<p:tabMenu activeIndex="#{param.i}">
<p:menuitem value="Home" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-home">
<f:param name="i" value="0"/>
</p:menuitem>
<p:menuitem value="Calendar" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-calendar"
badge="#{menuBadgeView.badgeModel}">
<f:param name="i" value="1"/>
</p:menuitem>
<p:menuitem value="Edit" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-pencil"
disabled="true">
<f:param name="i" value="2"/>
</p:menuitem>
<p:menuitem value="Documentation" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-file">
<f:param name="i" value="3"/>
</p:menuitem>
<p:menuitem value="Settings" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-cog">
<f:param name="i" value="4"/>
</p:menuitem>
</p:tabMenu>
</div>
<div class="card">
<h5 class="mt-0">Orientation Left</h5>
<p:tabMenu activeIndex="#{param.i}" style="width:15rem" orientation="left">
<p:menuitem value="Home" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-home">
<f:param name="i" value="0"/>
</p:menuitem>
<p:menuitem value="Calendar" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-calendar">
<f:param name="i" value="1"/>
</p:menuitem>
<p:menuitem value="Edit" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-pencil"
disabled="true">
<f:param name="i" value="2"/>
</p:menuitem>
<p:menuitem value="Documentation" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-file">
<f:param name="i" value="3"/>
</p:menuitem>
<p:menuitem value="Settings" outcome="/ui/menu/tabMenu" icon="pi pi-fw pi-cog">
<f:param name="i" value="4"/>
</p:menuitem>
</p:tabMenu>
</div>
package org.primefaces.showcase.view.menu;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;
import io.quarkus.runtime.annotations.RegisterForReflection;
import org.primefaces.model.badge.BadgeModel;
import org.primefaces.model.badge.DefaultBadgeModel;
@Named
@RequestScoped
@RegisterForReflection(serialization = true)
public class MenuBadgeView {
private BadgeModel badgeModel;
@PostConstruct
public void init() {
badgeModel = DefaultBadgeModel.builder()
.severity("danger")
.build();
}
public BadgeModel getBadgeModel() {
return badgeModel;
}
}