Skip to content
Blocks Meter

Meter

A gauge: bar, ring or scale.

On this page

Examples

Bar, ring, parts and scale

KlyMeter is a role="meter" measure (disk used, quota), not the progress of a task: use KlyProgress for that.

Storage 92 GB of 100 GB
64%
Quota
Disk by kind 0 / 10
  • Photos 3 GB
  • Video 4 GB
Risk 0 / 100
Low
Medium
High
Razor
<div class="grid w-full gap-4 md:grid-cols-2">
    <KlyMeter Title="Storage" Value="92" WarningThreshold="75" ErrorThreshold="90" ValueText="92 GB of 100 GB" Surface="KlySurface.Bordered" />
    <KlyMeter Layout="KlyMeterLayout.Ring" Title="Quota" Value="64" Surface="KlySurface.Bordered" />
    <KlyMeter Title="Disk by kind" Max="10" Surface="KlySurface.Bordered" Parts="@(new[]
    {
        new KlyMeterPart("Photos", 3) { ValueLabel = "3 GB", Color = KlyColor.Info, Icon = "image" },
        new KlyMeterPart("Video", 4) { ValueLabel = "4 GB", Color = KlyColor.Warning },
    })" />
    <KlyMeter Layout="KlyMeterLayout.Scale" Title="Risk" Levels="@(new[] { "Low", "Medium", "High" })" CurrentLevel="1" Surface="KlySurface.Bordered" />
</div>

API

KlyMeter

A gauge in a known range: a bar, a ring or a scale of levels, with thresholds or stacked parts and a legend.

Parameters

Name Type Default Description
Class string Classes added to the root element, merged last so they win over the theme.
CurrentLevel int? The zero-based index of the current level of a scale. The levels up to it are highlighted.
Description string A line of smaller text under the meter.
ErrorThreshold Double? The percentage of Max from which the bar turns to the error color. It wins over WarningThreshold .
Layout KlyMeterLayout KlyMeterLayout.Bar The drawing: a bar, a ring with the value in its center, or a scale of discrete levels (a bar when there are no Levels ). Values: Bar, Ring, Scale.
Levels IReadOnlyList<string> The level labels of a Scale .
Loading bool false Shows a skeleton placeholder instead of the content.
Max Double 100 The maximum ( 100 by default). When it is zero or less, the sum of Parts is used.
Parts IReadOnlyList<KlyMeterPart> The segments, stacked in the bar or around the ring. When set, they replace the single value and the thresholds do not apply. A legend lists them when one of them has a ValueLabel , an Icon or a Max .
Surface KlySurface? The surface treatment. Plain when not set. Values: Plain, Muted, Bordered, Elevated.
Title string The label of the meter, and its accessible name ( Meter when not set).
Ui MeterUi Per-instance class overrides of the slots of the meter, see MeterUi . They are merged after the theme and the Class parameter wins on the root slot.
Value Double 0 The current value, clamped between 0 and Max .
ValueText string The value as displayed, such as "3.2 GB" . When not set, the number out of the maximum (the percentage in the center of a ring).
WarningThreshold Double? The percentage of Max from which the bar turns to the warning color.

Ui slots

Ui takes a MeterUi with one class string per slot, merged after the theme.

Slot Styles
Root Classes merged into the root slot of KlyMeter , after the theme and the app configuration.
Header Classes merged into the header slot of KlyMeter , after the theme and the app configuration.
Label Classes merged into the label slot of KlyMeter , after the theme and the app configuration.
Value Classes merged into the value slot of KlyMeter , after the theme and the app configuration.
Track Classes merged into the track slot of KlyMeter , after the theme and the app configuration.
Bar Classes merged into the bar slot of KlyMeter , after the theme and the app configuration.
Part Classes merged into the part slot of KlyMeter , after the theme and the app configuration.
Ring Classes merged into the ring slot of KlyMeter , after the theme and the app configuration.
RingSvg Classes merged into the ringSvg slot of KlyMeter , after the theme and the app configuration.
RingDrawing Classes merged into the ringDrawing slot of KlyMeter , after the theme and the app configuration.
RingTrack Classes merged into the ringTrack slot of KlyMeter , after the theme and the app configuration.
RingArc Classes merged into the ringArc slot of KlyMeter , after the theme and the app configuration.
RingValue Classes merged into the ringValue slot of KlyMeter , after the theme and the app configuration.
RingText Classes merged into the ringText slot of KlyMeter , after the theme and the app configuration.
Caption Classes merged into the caption slot of KlyMeter , after the theme and the app configuration.
Scale Classes merged into the scale slot of KlyMeter , after the theme and the app configuration.
Level Classes merged into the level slot of KlyMeter , after the theme and the app configuration.
Legend Classes merged into the legend slot of KlyMeter , after the theme and the app configuration.
LegendItem Classes merged into the legendItem slot of KlyMeter , after the theme and the app configuration.
LegendIcon Classes merged into the legendIcon slot of KlyMeter , after the theme and the app configuration.
LegendDot Classes merged into the legendDot slot of KlyMeter , after the theme and the app configuration.
LegendLabel Classes merged into the legendLabel slot of KlyMeter , after the theme and the app configuration.
LegendValue Classes merged into the legendValue slot of KlyMeter , after the theme and the app configuration.
Skeleton Classes merged into the skeleton slot of KlyMeter , after the theme and the app configuration.