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
| Product | Qty | Unit | Price | Disc. % | 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-modelis the list of lines. Each line has anid, aproduct, aquantity, and apriceof one. It can also have aunit, adiscountin percent, and ataxin 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.
unitsis the list of units in the menu (default pcs, hour, box, and kg).currencyis an ISO 4217 code (defaultUSD), andlocalesets the format.- Change the words with
labelsor 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
| Name | Type | Default | Description |
|---|---|---|---|
currency | string | "USD" | |
locale | string | "en" | |
units | string[] | ["pcs", "hour", "box", "kg"] | units to pick from |
labels | Partial<{ 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; }> | — | |
modelValue | BlessLineItem[] | [] |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: BlessLineItem[]] |