MeterGroup displays scalar measurements within a known range.
import MeterGroup from 'primevue/metergroup';
MeterGroup requires a value as the data to display where each item in the collection should be a type of MeterItem.
<MeterGroup :value="value" />
Adding more items to the array displays the meters in a group.
<MeterGroup :value="value" />
Icons can be displayed next to the labels instead of the default marker.
<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.
<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.
<MeterGroup :value="value" orientation="vertical" labelOrientation="vertical" />
Boundaries are configured with the min and max values whose defaults are 0 and 100 respectively.
<MeterGroup :value="value" :max="200" />
MeterGroup provides templating support for labels, meter items, and content around the meters.
<MeterGroup :value="value" labelPosition="start">
<template #label="{ value }">
<div class="flex flex-wrap gap-4">
<template v-for="val of value" :key="val.label">
<Card class="flex-1 border border-surface shadow-none">
<template #content>
<div class="flex justify-between gap-8">
<div class="flex flex-col gap-1">
<span class="text-surface-500 dark:text-surface-400 text-sm">{{ val.label }}</span>
<span class="font-bold text-lg">{{ val.value }}%</span>
</div>
<span class="w-8 h-8 rounded-full inline-flex justify-center items-center text-center" :style="{ backgroundColor: `${val.color1}`, color: '#ffffff' }">
<i :class="val.icon" />
</span>
</div>
</template>
</Card>
</template>
</div>
</template>
<template #meter="slotProps">
<span :class="slotProps.class" :style="{ background: `linear-gradient(to right, ${slotProps.value.color1}, ${slotProps.value.color2})`, width: slotProps.size }" />
</template>
<template #start="{ totalPercent }">
<div class="flex justify-between mt-4 mb-2 relative">
<span>Storage</span>
<span :style="{ width: totalPercent + '%' }" class="absolute text-right">{{ totalPercent }}%</span>
<span class="font-medium">1TB</span>
</div>
</template>
<template #end>
<div class="flex justify-between mt-4">
<Button label="Manage Storage" outlined size="small" />
<Button label="Update Plan" size="small" />
</div>
</template>
</MeterGroup>
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.