Meter
Server-safe gauge for a value in a known range (storage, quota, server load, password strength). Colors by <meter> thresholds, or stacked segments with a legend, like a storage bar.
- Clips
- Thumbnails
- Backups
import { Meter } from "@/components/ui/meter";export function Storage() { return ( <Meter label="Clip storage" valueText="71 GB of 100 GB" segments={[ { label: "Clips", value: 48 }, { label: "Thumbnails", value: 9 }, { label: "Backups", value: 14 }, ]} /> );}<Meter>
A measurement within a known range (disk, quota, server load, password strength), not a task's progress (use Progress). Colors follow <meter>: green in the optimum region, orange one region away, red two away.
highdefaultmaxnumberAbove this the value is high.
labelReactNodeVisible name above the bar; also the accessible name.
lowdefaultminnumber<meter> thresholds: below
lowis low, abovehighis high.maxdefault100numberUpper bound.
mindefault0numberLower bound.
optimumdefault(min + max) / 2numberWhere good is: below low, between, or above high. Decides the color, like <meter>.
segmentsSegment[]Stacked parts with a legend (like a storage bar). Overrides the threshold color.
valuenumberTotal used. With
segments, defaults to their sum.valueTextstringText on the right and the accessible value, e.g. "48 GB of 100 GB".
| Prop | Type | Default |
|---|---|---|
highAbove this the value is high. | number | max |
labelVisible name above the bar; also the accessible name. | ReactNode | — |
low<meter> thresholds: below | number | min |
maxUpper bound. | number | 100 |
minLower bound. | number | 0 |
optimumWhere good is: below low, between, or above high. Decides the color, like <meter>. | number | (min + max) / 2 |
segmentsStacked parts with a legend (like a storage bar). Overrides the threshold color. | Segment[] | — |
valueTotal used. With | number | — |
valueTextText on the right and the accessible value, e.g. "48 GB of 100 GB". | string | — |
- type Segment
- { label: string; value: number; className?: string; }
* required. Every component also takes className.