Introducing PrimeReact v11-alpha 🎉Discover Now

MeterGroup

MeterGroup displays scalar measurements within a known range.

Disk usage
  1. Apps (14%)
  2. Messages (12%)
  3. Media (8%)
  4. System (12%)
  5. Documents (6%)
  6. Cache (11%)
  7. Other (9%)
preview

Installation#

npx shadcn@latest add @primereact/metergroup

Usage#

import { MeterGroup, MeterGroupMeters, MeterGroupMeter, MeterGroupLabels, MeterGroupLabel, MeterGroupMarker, MeterGroupText } from '@/components/ui/metergroup';
<MeterGroup>
    <MeterGroupMeters>
        <MeterGroupMeter />
    </MeterGroupMeters>
    <MeterGroupLabels>
        <MeterGroupLabel>
            <MeterGroupMarker />
            <MeterGroupText></MeterGroupText>
        </MeterGroupLabel>
    </MeterGroupLabels>
</MeterGroup>

Examples#

Basic#

Visualizes multiple values as segmented horizontal bars.

  1. Space used (15%)
basic-demo

Multiple#

Data is displayed in the MeterGroup.Meter component using the value and color properties. Adding more MeterGroup.Meter components displays the meters in a group. Pass index to MeterGroup.Meter and MeterGroup.Marker to identify the meter's and label's position to get the color.

  1. Apps (14%)
  2. Messages (12%)
  3. Media (8%)
  4. System (12%)
  5. Documents (6%)
  6. Cache (11%)
  7. Other (9%)
multiple-demo

Color#

MeterGroup.Meter and MeterGroup.Marker components supports custom color values. Use color property or pass color with className or style. color has custom color names like blue, emerald, violet, amber, etc. or hex, rgb, hsl, or hsla values.

  1. Violet
  2. Emerald
  3. Rose
  4. Blue
  5. Yellow
color-demo

Icon#

Icons can be displayed next to the labels instead of the default MeterGroup.Marker.

  1. Apps (16%)
  2. Messages (8%)
  3. Media (24%)
  4. System (10%)
icon-demo

Label#

The default orientation of the labels is horizontal, and the vertical alternative is available through the orientation option.

  1. Apps (16%)
  2. Messages (8%)
  3. Media (24%)
  4. System (10%)
label-demo

Vertical#

Layout of the MeterGroup is configured with the orientation property that accepts either horizontal or vertical as available options.

  1. Apps (24%)
  2. Messages (16%)
  3. Media (24%)
  4. System (12%)
vertical-demo

Min-Max#

Boundaries are configured with the min and max values whose defaults are 0 and 100 respectively.

  1. Apps (8%)
  2. Messages (4%)
  3. Media (12%)
  4. System (5%)
minmax-demo

Template#

MeterGroup provides templating support for labels, meter items, and content around the meters.

  1. Apps25%
  2. Messages15%
  3. Media20%
  4. System10%
Storage70%1TB
template-demo

API#

Sub-Components#

See Primitive API for MeterGroupRoot, MeterGroupMeters, MeterGroupMeter, MeterGroupLabels, MeterGroupLabel, MeterGroupMarker, MeterGroupIcon, MeterGroupText component documentation.

Hooks#

See Headless API for useMeterGroup hook documentation.

Accessibility#

See MeterGroup Primitive for WAI-ARIA compliance details and keyboard support.