Open this example in the interactive library
Source code
// app/billing/page.tsx
export default function CollectedRevenueShare() {
const invoices = [
{ id: "A", cents: 3200, paid: true, due: "2028-01-10" },
{ id: "B", cents: 7900, paid: false, due: "2028-02-15" },
{ id: "C", cents: 4600, paid: false, due: "2028-03-20" },
];
const total = invoices.reduce((s, i) => s + i.cents, 0);
const paid = invoices.filter((i) => i.paid).reduce((s, i) => s + i.cents, 0);
return (
<label>
Collected <progress max={total} value={paid} /> {Math.round((paid / total) * 100)}
%
</label>
);
}
