Usage meter
Show what fills an allowance and how close it is to the limit.
npx shadcn@latest add @silicon-ui/usage-meterInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/usage-meterManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/usage-meter/usage-meter.tsx
- components/silicon-ui/usage-meter/usage-meter.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
label*What is measured, such as "Workspace storage". | string | — |
segments*Used amounts in display order. Up to four read clearly. | UsageMeterSegment[] | — |
limit*The plan limit, in the same unit as the segments. | number | — |
unit | string | "" |
decimalsDigits after the decimal point. | number | 1 |
freeLabel | string | "Free" |
overLabel | string | "Over limit" |
warnAtShare of the limit at which the meter warns that it is almost full. | number | .9 |
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens