Skip to content

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.

Storage healthClassify the value as optimum, suboptimal, or even less good from explicit thresholds.82 GB used

Exact decimal

Enter 0.1 as decimal text and preserve it without binary floating-point coercion.

Storage healthEnter 0.1 as decimal text and preserve it without binary floating-point coercion.0.1 GB used

Equal bounds

Represent the only valid value when the minimum and maximum are equal.

Storage healthRepresent the only valid value when the minimum and maximum are equal.7 GB used

API

Vue package: @sectile/vue/meter

Components
  • MeterRoot
  • MeterTrack
  • MeterIndicator
  • MeterValueText

Props

MeterRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

formatValue

Formats a value for visible text.

high

Lower boundary of the high-value region.

label

Accessible name announced for the control.

low

Upper boundary of the low-value region.

max

Largest value accepted by the component.

min

Smallest value accepted by the component.

optimum

Value that determines which threshold region is optimal.

value

Current value exposed by this contract.

MeterPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

Slots

MeterRootSlotProps

high

Lower boundary of the high-value region.

low

Upper boundary of the low-value region.

max

Maximum of the numeric range.

min

Minimum of the numeric range.

optimum

Value that determines the optimal threshold region.

percentage

Current value expressed as a percentage of its range.

value

Current value exposed by this contract.

valueText

Formatted text for the current range value when available.

zone

Quality region derived from the thresholds and optimum value.

Other types

MeterValueFormatter

ts
type MeterValueFormatter = (value: string) => string

Parts

Shared scope: [data-scope="meter"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra 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

KeyBehavior
NoneThe 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.

Released under the MIT License.