Feedback

Meter

Bounded measurement gauge with meter semantics for readings like battery, quota, CPU, and memory utilization.

import { Meter } from '@lostgradient/cinder';
feedbackmeasurementgauge
01

Overview

Reference usage

Bounded measurement gauge for fluctuating values like battery, quota, CPU, and memory usage.

Use Meter for static measurements with known bounds (role="meter"). Use Progress for task completion over time (role="progressbar").

Usage

svelte
<script lang="ts">
  import { Meter } from '@lostgradient/cinder';
</script>

<Meter value={52} ariaLabel="Battery level" />

For a measurement that has no numeric reading, provide an unknown verdict. Its label is rendered next to the empty track and included in the status's accessible name. Known verdict levels keep role="meter", the numeric fill, and expose the verdict label through aria-valuetext.

svelte
<Meter verdict={{ level: 'unknown', label: 'Awaiting data' }} ariaLabel="Service health" />

To break a reading into named shares, pass segments. The shares stack from the start of the track, each a lighter tone of the accent, and a legend beneath the track names every share with its amount, so the tones never carry the meaning alone. remainder adds a last legend line for the unfilled track. The reading is the sum of the shares, so value is ignored.

svelte
<script lang="ts">
  import { Meter } from '@lostgradient/cinder';
</script>

<Meter
  max={200_000}
  segments={[
    { label: 'Instructions and tools', value: 28_000, valueLabel: '28K' },
    { label: 'Conversation', value: 33_000, valueLabel: '33K' },
    { label: 'Tool results', value: 15_000, valueLabel: '15K' },
  ]}
  remainder={{ label: 'Free', valueLabel: '124K' }}
  ariaLabel="Context"
  ariaValueText="76K of 200K tokens"
/>
Live preview

Basic meter

Awaiting estimate

02

When to use

Use when
  • Showing a fluctuating value within a known minimum and maximum range.
  • Communicating low/optimal/high regions of a bounded measurement.
Avoid when
03

Examples

Basic meter

Bounded measurement for a fluctuating value.

Custom range

Map the meter to a non-zero bounded range.

Segmented thresholds

Render low, optimal, and high regions while preserving meter semantics for assistive technology.

Stacked shares with a legend

Break one reading into named shares, such as what fills a context window, with the room that is left.

04

Props

Props for meter
Name
Type
Default
Description
verdict { level: MeterVerdictLevel; label: string; } Semantic label for a measurement; unknown represents the non-numeric status case.
segments MeterSegment[] Splits the filled part of the track into named shares and lists them in a legend beneath it, such as the instructions, conversation and tool results that make up a context window. The shares stack from the start of the track in the order given, each a lighter tone of the accent, so the legend carries the meaning and colour never has to. The reading is their sum, so value is ignored, and threshold regions are not drawn.
remainder { /** Visible name of the unfilled part, such as `Free`. */ label: string; /** Text shown beside the label in the legend, such as `124K`. Defaults to what…
Show full type { /** Visible name of the unfilled part, such as `Free`. */ label: string; /** Text shown beside the label in the legend, such as `124K`. Defaults to what is left of `max`. */ valueLabel?: string; }
With segments, adds a last legend line for the unfilled track, such as "Free 124K".
value number 0 Current measurement value. Defaults to 0.
min number Lower bound for the range. Defaults to 0.
max number Upper bound for the range. Defaults to 100.
low number Lower threshold boundary for segmented rendering.
high number Upper threshold boundary for segmented rendering.
optimum number Optimal target value. Influences computed state semantics to match native meter expectations.
size 'sm' | 'md' | 'lg' 'md' Size token for track height. Default md.
ariaValueText text Human-readable text exposed via aria-valuetext. When omitted, aria-valuetext is not rendered. Example: 50% (6 hours remaining).
ariaLabel text Accessible name applied directly to the meter element when no visible label element is present.
ariaLabelledby text Id of a visible element that serves as the accessible name for the meter. Prefer this when a visible label exists.
05

Accessibility