Meter
Show an exact bounded measurement and classify it against quality thresholds.
Usage
Threshold zones
Classify the value as optimum, suboptimal, or even less good from explicit thresholds.
<!-- Meter / Threshold Zones -->
<script setup lang="ts">
import { MeterRoot, MeterTrack, MeterIndicator, MeterValueText } from '@sectile/vue/meter'
</script>
<template>
<MeterRoot value="82" min="0" max="100" low="35" high="75" optimum="20" label="Storage health" v-slot="{ zone }">
<MeterTrack><MeterIndicator /></MeterTrack>
<MeterValueText />
<span aria-hidden="true">{{ zone }}</span>
</MeterRoot>
</template>Exact decimal
Enter 0.1 as decimal text and preserve it without binary floating-point coercion.
<!-- Meter / Exact Decimal -->
<script setup lang="ts">
import { MeterRoot, MeterTrack, MeterIndicator, MeterValueText } from '@sectile/vue/meter'
</script>
<template>
<MeterRoot value="0.1" min="0" max="0.3" low="0.1" high="0.2" optimum="0.15" label="Storage health" v-slot="{ zone }">
<MeterTrack><MeterIndicator /></MeterTrack>
<MeterValueText />
<span aria-hidden="true">{{ zone }}</span>
</MeterRoot>
</template>Equal bounds
Represent the only valid value when the minimum and maximum are equal.
<!-- Meter / Degenerate Range -->
<script setup lang="ts">
import { MeterRoot, MeterTrack, MeterIndicator, MeterValueText } from '@sectile/vue/meter'
</script>
<template>
<MeterRoot value="7" min="7" max="7" label="Storage health" v-slot="{ zone }">
<MeterTrack><MeterIndicator /></MeterTrack>
<MeterValueText />
<span aria-hidden="true">{{ zone }}</span>
</MeterRoot>
</template>API
Vue package: @sectile/vue/meter
MeterRootMeterTrackMeterIndicatorMeterValueText
Props
MeterRootProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
formatValueFormats a value for visible text.
highLower boundary of the high-value region.
labelAccessible name announced for the control.
lowUpper boundary of the low-value region.
maxLargest value accepted by the component.
minSmallest value accepted by the component.
optimumValue that determines which threshold region is optimal.
valueCurrent value exposed by this contract.
MeterPartProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
Slots
MeterRootSlotProps
highLower boundary of the high-value region.
lowUpper boundary of the low-value region.
maxMaximum of the numeric range.
minMinimum of the numeric range.
optimumValue that determines the optimal threshold region.
percentageCurrent value expressed as a percentage of its range.
valueCurrent value exposed by this contract.
valueTextFormatted text for the current range value when available.
zoneQuality region derived from the thresholds and optimum value.
Other types
MeterValueFormatter
type MeterValueFormatter = (value: string) => stringParts
Shared scope: [data-scope="meter"]. Combine it with a part selector to keep styles local to this component.
| Part | Selector | Role | Extra attributes |
|---|---|---|---|
root | [data-part="root"] | Exposes the named read-only measurement and its exact range value. | role="meter"data-zone="<zone>"data-percentage="<percentage>" |
track | [data-part="track"] | Provides the visual path for the bounded measurement. | — |
indicator | [data-part="indicator"] | Fills the exact percentage without adding another accessible value. | aria-hidden="true"data-zone="<zone>"data-percentage="<percentage>" |
value-text | [data-part="value-text"] | Displays the formatted value as text. | — |
Keyboard interaction
| Key | Behavior |
|---|---|
| None | The range display is read-only and defines no keyboard interaction. |
Accessibility
The named read-only meter exposes its minimum, maximum, current value, and formatted value text without inventing ARIA threshold attributes.
See the corresponding WAI-ARIA pattern for the host accessibility contract.
