fetaUI
GitHub

Usage Meter

A metric against its limit, with an 8 px track and a plain hint. State comes from the numbers.

FreeWeb and MobileMotion

Preview

npx shadcn add @fetaui/usage-meter
Playground
API callsResets Nov 1

42,180 of 100,000

Steady pace, well within your plan.

States
API callsResets Nov 1

42,180 of 100,000

Steady pace, well within your plan.

API calls86% used

86,400 of 100,000

At this pace you reach the limit in 3 days.

API callsOver limit

112,040 of 100,000

Overage billed at $0.002 per call, about $24 so far.

State
Icons animation
Motion

Installation

Terminal· bash
 npx shadcn add @fetaui/usage-meter

States

State comes from the numbers: Warning from 80%, Over limit past 100%.

API callsResets Nov 1

42,180 of 100,000

Steady pace, well within your plan.

API calls86% used

86,400 of 100,000

At this pace you reach the limit in 3 days.

API callsOver limit

112,040 of 100,000

Overage billed at $0.002 per call, about $24 so far.

Motion

Accessibility

  • Uses the meter role with a name and value.
  • Warning and Over limit repeat as a Badge and in the hint.

Motion

  • The card fades in and rises 8 px over 400 ms.
  • The fill tweens over 400 ms and the number with it.
  • Warning starts at 80%. Over limit fills the track in danger.
  • With reduced motion, values swap at once.

Responsive behavior

  • 420 wide on Web and 358 on Mobile.

Performance

  • The fill moves on a transform over 400 ms, so a new value never runs layout.
  • The number tweens by writing text directly, so React does not render per frame.

Note for AI

Give your coding assistant the Markdown reference instead of screenshots.

  • Import UsageMeter from @/components/fetaui/usage-meter. It composes Meter, Tag and Tween from data-kit.
  • State comes from used over limit: Warning from 80%, Over limit past 100%. There is no state prop.
  • meta shows only while Normal, because the badge takes its place. hint is your text, so make it say what happens next.
  • Use unit for a word like GB and format for currency or short numbers. Pass your own icon to replace the default.

Related