Dev Helpers

UI Components / Tables and lists

List bins carrying the same part

Dev Helpers · April 8, 2026

An inventory may place one SKU in more than one bin. Grouping bin labels under the SKU prevents one location from replacing another.

Worked example

<style>
  dl {
    display: grid;
    gap: 0.6rem;
    margin: 0;
  }
  dl > div {
    display: grid;
    gap: 0.35rem;
    padding: 0.6rem;
    border-bottom: 1px solid #bbb;
  }
  dt {
    font-weight: 700;
  }
  dd {
    margin: 0;
    overflow-wrap: anywhere;
  }
  @media (min-width: 32rem) {
    dl > div {
      grid-template-columns: minmax(5rem, 1fr) 3fr;
    }
  }
</style>
<h2>List bins carrying the same part</h2>
<details>
  <summary>Input records</summary>
  <pre>
[
  {
    "sku": "pen",
    "bin": "A",
    "qty": 4
  },
  {
    "sku": "pad",
    "bin": "B",
    "qty": 0
  },
  {
    "sku": "pen",
    "bin": "B",
    "qty": 3
  },
  {
    "sku": "clip",
    "bin": "A",
    "qty": 9
  }
]</pre>
</details>
<dl class="" id="result"></dl>
<script>
  const rows = [
    { sku: "pen", bin: "A", qty: 4 },
    { sku: "pad", bin: "B", qty: 0 },
    { sku: "pen", bin: "B", qty: 3 },
    { sku: "clip", bin: "A", qty: 9 },
  ];
  const result = Object.fromEntries(
    [...new Set(rows.map((r) => r.sku))].map((sku) => [
      sku,
      rows.filter((r) => r.sku === sku).map((r) => r.bin),
    ]),
  );
  const list = document.querySelector("#result");
  list.replaceChildren();
  for (const [key, value] of Object.entries(
    typeof result === "object" && result !== null ? result : { value: result },
  )) {
    const row = document.createElement("div");
    const label = document.createElement("dt");
    label.textContent = key;
    const detail = document.createElement("dd");
    detail.textContent =
      typeof value === "string" ? value : JSON.stringify(value);
    row.append(label, detail);
    list.append(row);
  }
  if (!list.children.length) list.after("No matching entries.");
</script>

Implementation notes

Group by a stable part identifier. Product labels can change or repeat, even when they appear distinct in a small fixture.

Try it yourself

Add another bin for an existing SKU and check the before-and-after panel.

Open the UI Components example →

Editorial date April 8, 2026 · Published December 6, 2026

Related articles

Ranked leaderboard

A leaderboard needs an explicit tie policy and row labels. Colour alone is a weak way to distinguish position changes.

Article byline

A byline combines authorship and dates without competing with the headline. Use a machine-readable time value alongside the visible date.

Audio episode transcript card

An episode transcript serves readers who cannot or prefer not to play audio. Identify speakers in text and keep the transcript easy to navigate.