Components

Meter

Read-only gauge for displaying a bounded numeric value.

Meter displays a read-only value inside a known range. Use it for gauges like storage usage, quota, battery level, or health scores. It renders role="meter" with value ARIA metadata and exposes label, value, track, and indicator parts.

Use Meter for known bounded values. Use Progress for task completion, and Slider when the user can change the value.

Anatomy

  • #label: Custom visible label.
  • #value: Custom formatted value text.
  • #indicator: Custom content inside the filled indicator.

The role="meter" root and track are generated by the component. The root sets --akaza-meter-percentage, and thresholds expose data-akaza-state as low, normal, high, or optimum.

Usage

Storage used64

Examples

Basic gauge

Use a basic meter for a read-only value inside a known min/max range.

<template>
  <Meter label="Storage used" :value="64" />
</template>

Threshold states

Use low, high, and optimum to expose state for styling.

<template>
  <Meter
    label="Battery"
    :value="18"
    :low="20"
    :high="90"
    :optimum="80"
    :ui="{ indicator: 'data-[akaza-state=low]:bg-red-600' }"
  />
</template>

Formatted value

Use locale and formatOptions for displayed value text.

<template>
  <Meter
    label="Quota"
    :value="0.72"
    :max="1"
    :format-options="{ style: 'percent' }"
  />
</template>

Custom accessible value text

Use getAriaValueText when the numeric value needs a human-readable screen reader label.

<template>
  <Meter
    label="Storage"
    :value="64"
    :get-aria-value-text="(value, max) => `${value} of ${max} gigabytes used`"
  />
</template>

Custom slots

Slots receive value, formatted value, percentage, and state where relevant.

<template>
  <Meter :value="health" label="Health">
    <template #value="{ percentage }">
      {{ Math.round(percentage) }}%
    </template>
  </Meter>
</template>

API Reference

Props

PropTypeDefaultDescription
valuenumberrequiredCurrent value.
minnumber0Minimum value.
maxnumber100Maximum value.
lownumberLow threshold. Values below set data-akaza-state="low".
highnumberHigh threshold. Values above set data-akaza-state="high".
optimumnumberPreferred range hint.
labelstringVisible label. Also labels the meter.
ariaLabelstringAccessible label when no visible label exists.
ariaLabelledbystringlabel idAccessible label id.
ariaValueTextstringCustom aria-valuetext.
localeIntl.LocalesArgumentruntime localeLocale for formatted value.
formatOptionsIntl.NumberFormatOptionsNumber formatting options.
getAriaValueText(value, max, min) => string | undefinedBase-style function for aria-valuetext.
getValueLabel(formattedValue, value) => string | undefinedFunction for aria-valuetext.
uiMeterUiClasses for structural parts.

UI Options

KeyDescription
rootRoot meter element.
labelLabel text.
valueFormatted value text.
trackMeter track.
indicatorFilled indicator.

Slots

SlotPropsDescription
labelvalue, formattedValue, stateCustom label.
valuevalue, formattedValue, percentage, stateCustom formatted value.
indicatorvalue, percentage, stateCustom indicator content.

Styling Hooks

UI keyCSS classData attrs
rootakaza-meterdata-akaza-state
labelakaza-meter-label
valueakaza-meter-value
trackakaza-meter-track
indicatorakaza-meter-indicatordata-akaza-state

Meter sets --akaza-meter-percentage on the root. Plain class applies to the root meter.