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

Line-item editor ​

Rows of products with quantity, unit, price, discount, and tax, and the totals

Edits the lines of a quote, a sales order, a purchase order, or an invoice in an ERP. To show the result, use the invoice.

Basic
ProductQtyUnitPriceDisc. %Tax %Amount
Rp 1.708.100
Rp 720.000
Rp 1.400.000
Subtotal
Rp 3.918.000
Discounts
−Rp 89.900
Tax
Rp 421.091
Total
Rp 4.249.191
  • v-model is the list of lines. Each line has an id, a product, a quantity, and a price of one. It can also have a unit, a discount in percent, and a tax in percent.
  • Each cell is a native field. Each field has a name with its line, such as "Qty, line 2", so screen readers know which row they are in.
  • The amount of a line is quantity × price, less the discount. The tax is on that net amount.
  • "Add a line" adds an empty line with the unit and tax of the last line, and moves the focus to it. The ✕ button removes a line.
  • Under the table, the totals show the subtotal, the discounts, the tax, and the total. Screen readers hear the new totals after each change.
  • units is the list of units in the menu (default pcs, hour, box, and kg).
  • currency is an ISO 4217 code (default USD), and locale sets the format.
  • Change the words with labels or a label pack. The API table lists the keys.

The lineTotals and lineNet functions do the math. They are exported for your own views.

Usage ​

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

API ​

Props

NameTypeDefaultDescription
currencystring"USD"
localestring"en"
unitsstring[]["pcs", "hour", "box", "kg"]units to pick from
labelsPartial<{ title: string; product: string; quantity: string; unit: string; price: string; discount: string; tax: string; amount: string; add: string; remove: (row: number) => string; field: (what: string, row: number) => string; subtotal: string; discounts: string; taxes: string; total: string; }>—
modelValueBlessLineItem[][]

Events

NamePayloadDescription
update:modelValue[value: BlessLineItem[]]

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