Data & Media
@hacline/ui/meterMeter
Displays a measured value within a known range, such as storage quota.
Usage
Represent a measured value with min, max, and value, and provide a label with MeterLabel. MeterValue can display custom units.
Workspace storage
"use client";
import {
Meter,
MeterIndicator,
MeterLabel,
MeterTrack,
MeterValue,
} from "@/components/ui/hacline/components/meter";
export const Example = () => (
<Meter className="max-w-xs" max={20} min={0} value={14}>
<MeterLabel>Workspace storage</MeterLabel>
<MeterValue>14 / 20 GB</MeterValue>
<MeterTrack>
<MeterIndicator />
</MeterTrack>
</Meter>
);Highlighting Near-Limit Usage
Style the indicator bar based on business thresholds and show capacity status in text.
Build disk usage
Near capacity limit
"use client";
import {
Meter,
MeterIndicator,
MeterLabel,
MeterTrack,
MeterValue,
} from "@/components/ui/hacline/components/meter";
const utilization = 92;
export const Example = () => (
<Meter className="max-w-xs" value={utilization}>
<MeterLabel>Build disk usage</MeterLabel>
<MeterValue />
<MeterTrack>
<MeterIndicator
className={utilization >= 90 ? "bg-hl-danger" : undefined}
/>
</MeterTrack>
<p className="text-hl-fg-muted col-span-full text-xs">
{utilization >= 90 ? "Near capacity limit" : "Capacity available"}
</p>
</Meter>
);Parts
| Part | Description | Extended Props |
|---|---|---|
MeterIndicator | The filled part of the track, as wide as the value. | — |
MeterLabel | Names the meter. | — |
MeterTrack | The rail the indicator fills. | size |
MeterValue | The formatted value, like "40%". Children replace it. | — |
Props
Prop
Type