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.
- Video42 GB · 42%
- Images18 GB · 18%
- Docs9 GB · 9%
- Other6 GB · 6%
- Video42 · 61%
- Images18 · 26%
- Docs9 · 13%
Usage
import { BlessMeterGroup } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
segments* | BlessMeterSegment[] | — | |
max | number | — | |
label | string | "Usage" | |
legend | boolean | true | show the legend |
format | ((v: number) => string) | — | |
orientation | "horizontal" | "vertical" | "horizontal" |
Slots
| Name | Scope | Description |
|---|---|---|
legend | { segment: BlessMeterSegment; percent: number; } |