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 playgroundStorage62 / 100 GB
- Photos 38 GB
- Docs 16 GB
- Other 8 GB
38 GB left
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
npm i @ashutoshswamy/smouiUsage
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" / "#"
More pricing components
- BillingToggleMonthly/yearly switch. The thumb stretches to the choice and a savings badge pops in on yearly.
- OrderSummaryA checkout total. Type a promo code and a discount line slides in while the total rolls down; a wrong code shakes the field.
- PlanCompareFeature comparison. One column highlight stretches to the column you point at; rows and ticks cascade in.
- PlanPickerPlans as a radio list. One tinted block glides to the chosen plan, the radio fills with a pop and arrow keys move the choice.
- PricingCardOne plan card. Price rolls with billing, features tick in on scroll, the featured card sits on grainy mesh.
- PricingSliderUsage-based pricing. Drag the jelly thumb through tiers; the label rides its bubble and the price rolls.