Badge is a small status indicator for another element.
Badge can be used as a component.
import { Badge } from 'primereact/badge';
Content of the badge is specified using the value property.
<Badge value="2"></Badge>
Different color options are available as severity levels. When used as a component use the severity property to apply a severity.
<Badge value="2" severity="success"></Badge>
Buttons provide integrated badge support with the badge and badgeClass properties.
<Button type="button" label="Emails">
<Badge value="2"></Badge>
</Button>
<Button type="button" label="Messages" icon="pi pi-users" className="p-button-warning">
<Badge value="8" severity="danger">
</Button>
Badge sizes are adjusted with the size property that accepts "large" and "xlarge" as the possible alternatives to the default size.
<Badge value="2"></Badge>
<Badge value="4" size="large" severity="warning"></Badge>
<Badge value="6" size="xlarge" severity="success"></Badge>
In addition, when placed inside another element, badge sizes can also derive their size from their parent.
<h1>Heading 1 <Badge value="New"></Badge></h1>
<h2>Heading 2 <Badge value="New"></Badge></h2>
Any valid attribute is passed to the root element implicitly, extended properties are as follows;
Name | Type | Default | Description |
---|---|---|---|
value | any | null | Value to display inside the badge. |
severity | string | null | Severity type of the badge. |
size | string | null | Size of the badge, valid options are "large" and "xlarge". |
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
p-badge | Badge element |
p-overlay-badge | Wrapper of a badge and its target. |
p-badge-dot | Badge element with no value. |
p-badge-success | Badge element with success severity. |
p-badge-info | Badge element with info severity. |
p-badge-warning | Badge element with warning severity. |
p-badge-danger | Badge element with danger severity. |
p-badge-lg | Large badge element |
p-badge-xl | Extra large badge element |
This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.
None.
Built-in component themes created by the PrimeReact Theme Designer.
Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.
Beautifully crafted premium create-react-app application templates by the PrimeTek design team.