Order Table
<zn-order-table>
ZnOrderTable
Order tables show grouped order lines followed by subtotal, shipping, tax, discount and total rows.
<zn-order-table> { "headers": ["Product", "SKU", "Quantity", "Unit Price", "Subtotal", "Total"], "items": [ { "caption": "Electronics", "summary": "Devices and accessories", "data": [], "sub": [ { "caption": "Wireless Headphones", "summary": "Noise-cancelling over-ear model", "data": ["ELC-1021", "1", "£120.00", "£120.00", "£120.00"] }, { "caption": "USB-C Charger", "summary": "Fast-charging 65W adapter", "data": ["ELC-3054", "2", "£25.00", "£50.00", "£50.00"] }, { "caption": "Bluetooth Speaker", "summary": "Portable waterproof mini speaker", "data": ["ELC-4092", "1", "£55.00", "£55.00", "£55.00"] } ] }, { "caption": "Home & Kitchen", "summary": "Appliances and essentials", "data": [], "sub": [ { "caption": "Electric Kettle", "summary": "1.7L stainless steel kettle", "data": ["HMK-2210", "1", "£35.00", "£35.00", "£35.00"] }, { "caption": "Coffee Grinder", "summary": "Adjustable ceramic burr grinder", "data": ["HMK-2278", "1", "£40.00", "£40.00", "£40.00"] }, { "caption": "Kitchen Scale", "summary": "Digital scale, 5kg capacity", "data": ["HMK-2321", "1", "£22.00", "£22.00", "£22.00"] } ] }, { "caption": "Office Supplies", "summary": "Daily work essentials", "data": [], "sub": [ { "caption": "A4 Notebook", "summary": "200 pages, ruled", "data": ["OFC-1003", "3", "£4.00", "£12.00", "£12.00"] }, { "caption": "Ballpoint Pen Set", "summary": "Pack of 10 blue pens", "data": ["OFC-1045", "1", "£6.00", "£6.00", "£6.00"] }, { "caption": "Desk Organizer", "summary": "Metal mesh, 5 compartments", "data": ["OFC-1089", "1", "£18.00", "£18.00", "£18.00"] } ] } ], "subtotal": "£358.00", "shipping": "£4.99", "tax": "£34.80", "discount": "-£15.00", "total": "£382.79", "paid": "£250.00", "remaining": "£132.79" } </zn-order-table>
Pass the order as JSON, either in the data attribute or as the element’s text content as above.
-
headersnames the columns. The first column shows each line’scaptionandsummary;datafills the rest, in order. -
An item with
sublines is a group: its own row is a heading, and thesublines are listed under it. -
subtotal,shipping,tax,discount,total,paidandremainingare shown as summary rows under the table when set. They are display strings, so format the currency yourself.
Below 768px wide, each line is shown as a stacked card instead of a table row.