• 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

Badge

Badge is a small status indicator for another element.

Badge Tag Documentation

Badge is a small status indicator for another element like a button or a link.

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.
icon String false Icon of the badge.
iconPos String false left Position of the icon, default value is left.
onclick String false Client side callback to execute when the badge element clicked.
severity String false Severity type of the badge
size String false Size of the badge, valid options are "large" and "xlarge".
style String false Inline style of the component.
styleClass String false Style class of the component.
value String false Value to display inside the badge.
visible boolean false true Whether to hide the badge (but render the children).
Loading...
Tag DocumentationNew DocumentationNew Documentation
Numbers
28412375
Positioned Badge
2
10+
Button Badge
8
8
Sizes
246
Hidden
Icon
99
99

Usage


<div class="card">
    <h:form>
        <h5 class="mt-0">Numbers</h5>
        <p:badge value="2" styleClass="mr-2"></p:badge>
        <p:badge value="8" severity="success" styleClass="mr-2"></p:badge>
        <p:badge value="4" severity="info" styleClass="mr-2"></p:badge>
        <p:badge value="12" severity="warning" styleClass="mr-2"></p:badge>
        <p:badge value="3" severity="danger" onclick="alert('danger clicked!')" styleClass="mr-2"></p:badge>
        <p:badge value="7" severity="secondary" styleClass="mr-2"></p:badge>
        <p:badge value="5" severity="help"></p:badge>

        <h5 class="mb-4">Positioned Badge</h5>
        <p:badge value="2">
            <i class="pi pi-bell" style="font-size: 2rem"/>
        </p:badge>
        <p:badge value="10+" severity="danger">
            <i class="pi pi-calendar ml-4" style="font-size: 2rem"/>
        </p:badge>
        <p:badge severity="danger">
            <i class="pi pi-envelope ml-4" style="font-size: 2rem"/>
        </p:badge>

        <h5>Button Badge</h5>
        <p:badge value="8">
            <p:commandButton value="Emails"/>
        </p:badge>
        <p:badge value="8" severity="danger">
            <p:commandButton value="Messages" icon="pi pi-users" styleClass="ml-4" />
        </p:badge>

        <h5>Sizes</h5>
        <p:badge value="2" styleClass="mr-2"></p:badge>
        <p:badge value="4" styleClass="mr-2" size="large" severity="warning"></p:badge>
        <p:badge value="6" size="xlarge" severity="success"></p:badge>

        <h5>Hidden</h5>
        <p:badge value="0" visible="false">
            <i class="pi pi-bell" style="font-size: 2rem"/>
        </p:badge>
        
        <h5>Icon</h5>
        <p:badge icon="pi pi-bell" severity="danger">
            <p:commandButton value="Alerts" />
        </p:badge>
        <p:badge icon="pi pi-envelope" severity="danger">
            <p:commandButton value="Emails" styleClass="ml-4"/>
        </p:badge>
        <p:badge icon="pi pi-plus" iconPos="left" value=" 99" severity="danger" >
            <p:commandButton value="Left Icon" styleClass="ml-4"/>
        </p:badge>
        <p:badge icon="pi pi-plus" iconPos="right" value="99 " severity="danger">
            <p:commandButton value="Right Icon" styleClass="ml-4"/>
        </p:badge>
    </h:form>
</div>