Dev Helpers
← Back

Bin status matrix

Import and render <BinStatusMatrix /> in a React project.

Open this example in the interactive library

Live preview

Source code

// components/BinStatusMatrix.tsx

export default function BinStatusMatrix({
  counts = [12, 0, 5, 18],
  target = 10,
}: { counts?: number[]; target?: number } = {}) {
  return (
    <table>
      <tbody>
        {counts.map((n, i) => (
          <tr key={i}>
            <th>Bin {i + 1}</th>
            <td>{n}</td>
            <td>{!n ? "Empty" : n < target ? "Low" : "Ready"}</td>
          </tr>
        ))}
      </tbody>
    </table>
  );
}