Dot Receipt
When it scrolls into view the receipt feeds up out of the slot a line at a time, with the stutter of a stepper motor: product photos printed in thermal dots, the total last, then a barcode from the order number. The words are real text from the start, sums are done in cents, and with onTear you can drag the paper up until it tears off.
Needs: None. DOM and three small canvases.
Started from a receipt printer pin
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { name: string; price: number; qty?: number; note?: string; image?: string }[] | required | What was bought. A photo prints small, in the printer's dots. |
| lines | { label: string; amount: number }[] | "[]" | Shipping, tax, a discount below zero: added into the total. |
| store | string | – | The shop's name, large at the top. |
| order | string | – | The order number, printed and turned into the barcode. A new one prints a new receipt. |
| date | string | – | When, written as you want it shown. |
| currency | string | "USD" | ISO currency code for the money. |
| locale | string | "en-US" | How money is written. Fixed, so server and browser agree. |
| totalLabel | string | "Total" | The total's label. |
| footer | string | – | A line at the foot. |
| width | number | 300 | The paper's width in px. |
| autoPrint | boolean | true | Print when it first scrolls into view. |
| onTear | () => void | – | Makes it tearable; called when it tears off, then a copy prints. |
| tearLabel | string | "Save a copy" | The tear button's words. |
| tone | string | "#ec6a2c" | The printer's colour. |
| className | string | – | Class on the root. |
| style | CSSProperties | – | Style on the root. |