MeterGroup displays scalar measurements within a known range.
import { MeterGroupModule } from 'primeng/metergroup';
MeterGroup requires a value as the data to display where each item in the collection should be a type of MeterItem.
<p-meterGroup [value]="value" />
Adding more items to the array displays the meters in a group.
<p-meterGroup [value]="value" />
Icons can be displayed next to the labels instead of the default marker.
<p-meterGroup [value]="value" />
The position of the labels relative to the meters is defined using the labelPosition property. The default orientation of the labels is horizontal, and the vertical alternative is available through the labelOrientation option.
<p-meterGroup
[value]="value"
labelPosition="start"
labelOrientation="vertical" />
Layout of the MeterGroup is configured with the orientation property that accepts either horizontal or vertical as available options.
<p-meterGroup
[value]="value"
orientation="vertical"
labelOrientation="vertical"
[style]="{ height: '300px' }" />
Boundaries are configured with the min and max values whose defaults are 0 and 100 respectively.
<p-meterGroup [value]="value" [max]="200" />
MeterGroup provides templating support for labels, meter items, and content around the meters.
<p-meterGroup [value]="value" labelPosition="start">
<ng-template pTemplate="label">
<div class="flex flex-wrap gap-3">
<ng-container *ngFor="let meterItem of value; let index = index">
<p-card class="flex-1">
<div class="flex justify-content-between gap-5">
<div class="flex flex-column gap-1">
<span class="text-secondary text-sm">{{ meterItem.label }}</span>
<span class="font-bold text-lg">{{ meterItem.value }}%</span>
</div>
<span class="w-2rem h-2rem border-circle inline-flex justify-content-center align-items-center text-center" [style]="{ 'background-color': meterItem.color1, color: '#ffffff' }">
<i [class]="meterItem.icon"></i>
</span>
</div>
</p-card>
</ng-container>
</div>
</ng-template>
<ng-template pTemplate="meter" let-value let-class="class" let-width="size">
<span [class]="class" [style]="{ background: 'linear-gradient(to right, ' + value.color1 + ', ' + value.color2 + ')', width: width }"></span>
</ng-template>
<ng-template pTemplate="start" let-totalPercent="totalPercent">
<div class="flex justify-content-between mt-3 mb-2 relative">
<span>Storage</span>
<span [style]="{ width: totalPercent + '%' }" class="absolute text-right">{{ totalPercent }}%</span>
<span class="font-medium">1TB</span>
</div>
</ng-template>
<ng-template pTemplate="end">
<div class="flex justify-content-between mt-3">
<p-button label="Manage Storage" [outlined]="true" size="small" />
<p-button label="Update Plan" size="small" />
</div>
</ng-template>
</p-meterGroup>
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
p-metergroup | Container element. |
p-metergroup-horizontal | Container element when orientation mode is horizontal. |
p-metergroup-vertical | Container element when orientation mode is vertical. |
p-metergroup-meter-container | Container of the meters. |
p-metergroup-meter | Content of a meter. |
p-metergroup-label-list | Container element of the list of labels. |
p-metergroup-label-list-start | Container element when label position is start. |
p-metergroup-label-list-end | Container element when label position is end. |
p-metergroup-label-list-horizontal | Container element when label orientation is horizontal. |
p-metergroup-label-list-vertical | Container element when label orientation is vertical. |
p-metergroup-label-list-item | Container element of a list item. |
p-metergroup-label-list-type | Container element of a list type. |
p-metergroup-label | Content of a label. |
MeterGroup component uses meter role in addition to the aria-valuemin, aria-valuemax and aria-valuenow attributes. Value to describe the component can be defined using aria-labelledby prop.
Component does not include any interactive elements.
API defines helper props, events and others for the PrimeNG MeterGroup module.
MeterGroup displays scalar measurements within a known range.
Defines the input properties of the component.
Defines the templates used by the component.
Defines the custom interfaces used by the module.
Represents a meter item configuration.