Skip to content
Calm motion: animations on this site only fade, with no movement

MeterGroup ​

Multi-segment meter with legend

Parts of a whole on one bar (storage by file type, a budget by category, votes by option). A legend names each part, its value, and its share. With max, the bar is "used of available" and the remainder stays gray. Without max, the segments are shares of their own sum and fill the bar.

Colors come from --bless-color-chart-1..5 in order. A segment's color can be any token key (text-muted, accent) or a CSS color. format shapes the values. The #legend slot ({ segment, percent }) replaces a legend row. orientation="vertical" stands the bar up with the legend beside it. The bar is a role="meter" whose value is the sum, read through format ("75 GB of 100 GB"). The segments are decoration and the legend carries the detail.

One value on a bar is Progress. More than a handful of segments, or segments over time, is a Chart.

Basic
  • Video42 GB · 42%
  • Images18 GB · 18%
  • Docs9 GB · 9%
  • Other6 GB · 6%
  • Video42 · 61%
  • Images18 · 26%
  • Docs9 · 13%

Usage ​

ts
import { BlessMeterGroup } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
segments*BlessMeterSegment[]—
maxnumber—
labelstring"Usage"
legendbooleantrueshow the legend
format((v: number) => string)—
orientation"horizontal" | "vertical""horizontal"

Slots

NameScopeDescription
legend{ segment: BlessMeterSegment; percent: number; }

Released under the MIT License. Character names and artwork belong to their owners.