UsageMeter

Usage against a plan limit. The bar fills on a spring, splits by source, turns red past the limit and says what is left in plain words. Pricing.

Open playground
Storage62 / 100 GB
  • Photos 38 GB
  • Docs 16 GB
  • Other 8 GB
38 GB left
API calls9,400 / 10,000
Only 600 leftUpgrade plan
Seats14 / 10 seats
4 seats over your limitUpgrade plan

About

UsageMeter is a React component in the Pricing category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { UsageMeter } from "@ashutoshswamy/smoui" and set label, unit, breakdown among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { UsageMeter } from "@ashutoshswamy/smoui";

<UsageMeter label="Storage" used={62} limit={100} unit=" GB" breakdown={[{ label: "Photos", value: 38 }, { label: "Docs", value: 24 }]} upgrade="Upgrade plan" />

Props 4

label / used / limit

What is measured.

string / number / number
unit

Appended to numbers, e.g. " GB".

string
breakdown

Splits the bar by source.

{ label; value }[]
upgrade / href

Shown past 80% or over the limit.

stringdefault "Upgrade plan" / "#"