Meter

A measurement within a known range — storage used, a quota, a score: a bar filled to it, and the value screen readers hear. For a task getting done, a Progress.

Data DisplayExperimental

Usage

Usage

Storage used
import { Component, ViewEncapsulation } from '@angular/core';import {  ScMeter,  ScMeterIndicator,  ScMeterLabel,  ScMeterTrack,  ScMeterValue,} from '@semantic-components/ui';
/** A measurement in a known range: the bar filled to it, the value as a percent of the range (in the app’s language). */

Anatomy

The meter holds the value and the range; the label names it, the value part shows the value written, the track and its indicator draw the bar.

import { ScMeter, ScMeterIndicator, ScMeterLabel, ScMeterTrack, ScMeterValue } from '@semantic-components/ui';
<div scMeter [value]="68">  <span scMeterLabel>Storage used</span>  <span scMeterValue></span>  <div scMeterTrack><div scMeterIndicator></div></div></div>

The value

It follows yours — no output, no busy state (a meter always has a value). Written as a percent of the range by default, or as format says: number format options (a unit, a currency, a decimal — then the value itself) or a function of it; in the app's language (LOCALE_ID). A value outside the range is held to it for the bar, the percent and aria-valuenow; a format that isn't a percent writes it as given. The root sets --sc-meter-value, the percent.

Accessibility

  • A meter: its range, its value and the value written (aria-valuetext); named by its label, or aria-label.
  • The value shown is hidden from screen readers — the meter reads it. When it needs more words, valueLabel gives them.

Examples

Bounds

Credit score
import { Component, ViewEncapsulation } from '@angular/core';import {  ScMeter,  ScMeterIndicator,  ScMeterLabel,  ScMeterTrack,  ScMeterValue,} from '@semantic-components/ui';
/** min and max set where the value sits — a credit score, 300 to 850; format: the value itself, not a percent. */

Format

Storage
Budget
Seats
import { Component, ViewEncapsulation } from '@angular/core';import {  ScMeter,  type ScMeterFormat,  ScMeterIndicator,  ScMeterLabel,  ScMeterTrack,  ScMeterValue,} from '@semantic-components/ui';

Locale

Auslastung
import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import {  ScMeter,  ScMeterIndicator,  ScMeterLabel,  ScMeterTrack,  ScMeterValue,} from '@semantic-components/ui';
/** LOCALE_ID provided as ‘de’: the percent written in German (40 %, with a space before the sign). */

Value label

API requests
import { Component, ViewEncapsulation } from '@angular/core';import {  ScMeter,  ScMeterIndicator,  ScMeterLabel,  ScMeterTrack,  ScMeterValue,  type ScMeterValueLabelDetails,} from '@semantic-components/ui';

RTL

المساحة المستخدمة
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import {  ScMeter,  ScMeterIndicator,  ScMeterLabel,  ScMeterTrack,  ScMeterValue,} from '@semantic-components/ui';

API reference

Each part takes class, merged over its own (cn: a later class wins). The look is the style's progress bar (progress: track, label, value).

PartSelectorDescription
ScMeterdiv[scMeter] The value and the range: role meter. exportAs scMeter: text(), percent(), clamped().
ScMeterLabel[scMeterLabel] Its name.
ScMeterValue[scMeterValue] The value written — or your text inside it. Hidden from screen readers.
ScMeterTrackdiv[scMeterTrack] The bar.
ScMeterIndicatordiv[scMeterIndicator] The bar filled to the value, from the start of the line.
InputTypeDefaultDescription
valuenumber— Required: the reading.
min, maxnumber0, 100 The range.
formatIntl.NumberFormatOptions | (value) => string{ style: 'percent' } How the value is written.
valueLabel(value, { formatted, percent, min, max }) => string— What screen readers hear instead.