Usage meter

Free

How much of a usage window is spent and when it resets, in the viewer's own time, turning orange with "Out by 2:40 pm" when the pace would run out before the reset.

npx shadcn@latest add https://pixilui.com/r/usage-meter.json

Preview

Says when you'll run out, in your own time, before you do.
Session

When to use

Use it when

  • Plan limits on a rolling window: the five-hour session and the weekly limits.
  • A compact session meter in a composer footer (variant="inline").

Use something else when

  • A share with no clock: use Meter.
  • A bill in money: write the amount.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/usage-meter.json

Adds usage-meter.tsx with meter.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { UsageMeter } from "@/components/pixilui/usage-meter";

<UsageMeter windows={windows} />

Windows stack in a grid; each fills its width.

API reference

PropTypeDefault
windowsRequired(Omit<UsageMeterWindowProps, "now" | "locale" | "words" | "variant"> & { id: string })[]NONEThe windows, in order: the five-hour session first, then the weekly ones.
nownumber–A fixed clock (epoch ms) for every window.
localestring–The locale times print in.
wordsPartial<UsageMeterWords>–Every word the meters say.

Also takes every native <div> attribute, and a ref.

Keyboard

TabNever takes focus: it reports, it is not a control.

Accessibility

  • Each window is a meter named by its whole sentence: "5-hour limit: 84% used. At this pace you run out at 2:40 pm, before the reset at 4:14 pm."
  • Times print in the viewer's own time zone; the locale is a prop.

Motion

  • The fill follows the share; at a reset it drains back to zero, slower.
  • The phrase cross-fades when its meaning changes (resets, out by, resets in, just reset); the countdown ticks in place.
  • Reduced motion: instant.

PixilUI Pro opens soon. The first 20 licenses are $99.