Storage meter
Space used against a budget, in blocks per part, the total in mono, a legend.
import { StorageMeter } from "@forgeron/ui";Storage
44 GB of 100 GB
- My files8.4 GB
- Team drives31 GB
- App files4.1 GB
import { StorageMeter } from "@forgeron/ui";
export default function Default() {
return (
<div style={{ width: 240 }}>
<StorageMeter
quota={100e9}
parts={[
{ label: "My files", bytes: 8.4e9 },
{ label: "Team drives", bytes: 31.2e9 },
{ label: "App files", bytes: 4.1e9 },
]}
/>
</div>
);
}StorageR2
52 GB of 50 GB · over the budget
- My files18 GB
- Team drives34 GB
Mailbox
6.2 GB of 15 GB
// Past the budget the bar turns to danger and says so in words; the legend keeps the parts apart.
import { Chip, StorageMeter } from "@forgeron/ui";
export default function OverBudget() {
return (
<div style={{ display: "grid", gap: 24, width: 280 }}>
<StorageMeter
label="Storage"
quota={50e9}
action={<Chip>R2</Chip>}
parts={[
{ label: "My files", bytes: 18e9 },
{ label: "Team drives", bytes: 34e9 },
]}
/>
<StorageMeter
label="Mailbox"
quota={15e9}
cells={24}
parts={[{ label: "Mail", bytes: 6.2e9, tone: "ink" }]}
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
parts | { label, bytes, tone? }[] | — | What uses the space, in order; tones accent, ink, muted by default. |
quota | number | — | The budget in bytes; past it, danger. |
label | string | "Storage" | Above the bar. |
cells | number | 40 | How many blocks. |
action | ReactNode | — | At the end of the label row. |
legend | boolean | true | One line per part. |
className | string | — | Extra classes. |