Usage MeterFreev1.0.0
An allowance and what fills it: one hairline track split by category, the total against the limit in words, an amber rim near the limit, and past it a limit tick with the overage hatched after it.
pnpm dlx shadcn@latest add https://beautiful-ui.dev/r/lumen-usage-meter.jsonpnpm dlx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/lumen-usage-meter.jsonFree, no account or key. Use the command for your project's primitives: a radix-*, new-york or default style in components.json is Radix, a base-* style is Base UI. With the @beautiful-ui registry added, @beautiful-ui/<name> picks for you.
Install by hand
- 1. No extra packages: React and Tailwind CSS v4 are enough.
- 2. Copy the files to these paths (Source below, or save them all as a .zip)
- components/ui/lumen/controls/usage-meter.tsx
- 3. Paste styles.css into your global CSS, after @import "tailwindcss";
- 4. Install what it builds on first: shadcn's cn helper (lib/utils.ts, from npx shadcn init), the theme foundation (its tokens and base styles)
Styles didn't apply?
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Usage
Import it and pass your content. The props that matter most are listed next.
"use client";
import { UsageMeter } from "@/components/ui/lumen/controls/usage-meter";
export function StorageUsage() {
return (
<UsageMeter
label="Storage"
limit={10}
format={(v) => `${v} GB`}
segments={[
{ id: "media", label: "Media", value: 4.6 },
{ id: "docs", label: "Documents", value: 2.2 },
{ id: "backups", label: "Backups", value: 1.4 },
]}
/>
);
}Props
label–ReactNodeWhat the allowance is, e.g. "Storage". Names the meter.
segments–{ id, label, value, color? }[]What fills it, by category, in stacking order. Without colours they step down in ink.
limit–numberThe allowance.
warnAt0.8numberShare of the limit where the meter turns amber.
format–(value: number) => stringFormats amounts, e.g. (v) => `${v} GB`. Default: the locale's number.
locale–stringFor the default number and percent formats.
Show all 8 propsShow fewer
labels–Partial<UsageMeterLabels>Every sentence (total, left, near, over, full), for other languages.
showLegendtruebooleanThe categories with their amounts under the bar.
Source
components/ui/lumen/controls/usage-meter.tsx