Skip to content
Calm motion: animations on this site only fade, with no movement

Bill of materials ​

A tree of parts with quantities, and the total for one or more units

A bill of materials (BOM) lists what goes into a product, part by part. It plans a build in an ERP or a workshop app.

Basic
Desk mic kit
  • Microphone unit ASM-MIC1 each25 in all
  • Condenser capsule CAP-161 pcs each25 pcs in all
  • USB board PCB-USB1 pcs each25 pcs in all
  • Metal body BDY-AL1 pcs each25 pcs in all
  • M2 screw SCR-M26 pcs each150 pcs in all
  • Desk stand ASM-STD1 each25 in all
  • Weighted base BAS-011 pcs each25 pcs in all
  • M2 screw SCR-M22 pcs each50 pcs in all
  • USB-C cable, 2 m CBL-USBC1 pcs each25 pcs in all

Parts cost Rp 10.380.000

  • product is the name of the product at the top. parts is the tree. Each part has an id, a name, and the quantity for one of its parent. It can also have a sku, a unit, a cost of one, and children.
  • v-model:count is the number of products to build (default 1). Each row shows the quantity for one parent, "each", and the total for the build, "in all".
  • A part with children has a button that opens and closes its group. Screen readers hear whether the group is open.
  • The status line gives the cost of the raw parts for the build. A raw part is a part with no children. The same SKU in two places adds up.
  • currency is an ISO 4217 code (default USD), and locale sets the format.
  • Change the words with labels or a label pack: title, build, and the functions per, total, cost, and open.

The bomNeeds function lists the raw parts and the cost. It is exported, for example to make a purchase list.

Usage ​

ts
import { BlessBillOfMaterials } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
product*string—the product at the top
parts*BlessBomPart[]—
currencystring"USD"
localestring"en"
labelsPartial<{ title: string; build: string; per: (q: string) => string; total: (q: string) => string; cost: (amount: string) => string; open: (name: string) => string; }>—
countnumber1how many of the product to build

Events

NamePayloadDescription
update:count[value: number]

Released under the MIT License. Character names and artwork belong to their owners.