Blocks / Storage meter

Storage meter

Space used against a budget, in blocks per part, the total in mono, a legend.

import { StorageMeter } from "@forgeron/ui";
/01 → Default
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>
  );
}
/02 → Over budget
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
PropTypeDefaultDescription
parts{ label, bytes, tone? }[]—What uses the space, in order; tones accent, ink, muted by default.
quotanumber—The budget in bytes; past it, danger.
labelstring"Storage"Above the bar.
cellsnumber40How many blocks.
actionReactNode—At the end of the label row.
legendbooleantrueOne line per part.
classNamestring—Extra classes.