UsageBar
How much of a plan's limit is used: «7.2 GB of 8 GB». Near the limit it says what will happen and offers the next step before it is reached.
import { UsageBar } from '@sypnia/ui/react'
The limits of a plan
Rows120,400 of 500,000
Emails this month10,000 of 10,000
Code
import { LinkButton, UsageBar, useSypnia } from '@sypnia/ui/react';
// The limits of a plan. Near the limit it says so and offers the next step.
export default function Plan() {
const { format } = useSypnia();
const gb = (v: number) => format.bytes(v * 1e9);
return (
<div className="sy-stack">
<UsageBar label="Rows" used={120_400} limit={500_000} />
<UsageBar label="Storage" used={7.2} limit={8} format={gb} action={<LinkButton href="#plans" size="sm">See larger plans</LinkButton>} />
<UsageBar label="Emails this month" used={10_000} limit={10_000} resetsAt="2026-12-01" action={<LinkButton href="#plans" size="sm" variant="primary">Move to Pro</LinkButton>} />
</div>
);
} When to use it
Use it when
- Billing and plan pages, and the overview of a project.
- Pass
actionwith a link to the plans, andresetsAtfor monthly limits.
Do not use it when
- Measures without a plan behind them: use Meter.
For everyone
- It is a
meter; the warning near the limit is said in words.
Props
| UsageBar | Type | Default |
|---|---|---|
labelrequired | ReactNode | |
limitrequired | number | |
usedrequired | number | |
actionThe next step, shown from 80 %: usually a LinkButton to the plans. | ReactNode | |
formatHow amounts are written: bytes, rows, requests. Defaults to a number. | ((v: number) => string) | |
loadingThe amount is on its way: the label stays, the amount and the bar are skeletons. Pass the last known `used` and `limit`, so the amount's bar is as long as its words will be. | boolean | |
resetsAtWhen the count starts again, for monthly limits. | string | number | Date |