@m3000/marketv0.0.0

Receipt

Build order summaries with items, taxes, fees, and dynamic totals using smallest-unit integers with `bigint`.

Installation

pnpm add @m3000/market

Usage

Order Summary
Market print$15
Frame upgrade$24
Subtotal$39
Tax (10%)$3.9
Total$42.9

Receipt is built on the same price rendering model as Price: pass smallest-unit integer values as number, string, or bigint, set the decimal precision once, and let Receipt.Price define the shared formatting template.

Examples

Adjustments And Tax

Shows discounts, fees, computed tax from rate, and section separators.

Fulfillment Summary
Market print$125
Collector sleeve$18
Subtotal$143
Member discount-$12
Shipping$9.5
Tax (8.25%)$11.8
Total$152.3

Manual Values

Use explicit values when your backend already provides the subtotal, tax, or final amount.

Invoice Snapshot
Strategy workshop$5000
Implementation support$7500
Approved subtotal$12500
VAT recorded$2375
Amount due$14875

Custom Price Rendering

Customize the default receipt-wide price template and override the rendering for an individual line item when needed.

Custom Rendering
Artwork reserve2,800usd
Primary market fee$12.5
Total2,812.5usd

Precision And Abbreviation

Mix input precisions, control visible decimal places, and abbreviate large values while keeping a symbol-after-value layout.

Treasury Settlement
Block allocation1.25KUSDC
Broker credit25USDC
Network fee0.125USDC
Net settlement1.2752KUSDC

Full Receipt

Complete receipt with header metadata, adjustments, tax, total, and footer copy.

Order #12345March 16, 2026
Product A$2.5
Product B$1.8
Product C$0.7
Subtotal$5
Member Discount-$0.5
Shipping$0.2
Tax (8%)$0.4
Total$5.1
Thank you for your order.

API Reference

Receipt

The root component that provides context for price calculations.

PropTypeDefaultDescription
decimalsnumber6Default number of decimal places used by receipt values

Receipt.Price

Defines how prices are formatted throughout the receipt.

PropTypeDefaultDescription
maxDecimalsnumberdecimalsMaximum decimal places to display
abbreviatebooleanfalseAbbreviate large values with K, M, or B
childrenReactNoderequiredPrice formatting (Symbol + Value)

Receipt.Header

Renders the receipt header section. Accepts standard div props and className.

Receipt.Item

Adds an item to the receipt.

PropTypeDefaultDescription
labelstringrequiredItem description
valuenumber | bigint | stringrequiredRaw value in the smallest unit
decimalsnumberReceipt.decimalsDecimal precision for this row
maxDecimalsnumberReceipt.Price.maxDecimalsMaximum decimal places to display
abbreviatebooleanReceipt.Price.abbreviateOverride abbreviation for this row
childrenReactNodeReceipt.Price templateOverride the price rendering for this row

Receipt.Separator

Visual separator between sections. Accepts the same props as Separator.

Receipt.Subtotal

Displays the subtotal of all items.

PropTypeDefaultDescription
labelstring"Subtotal"Row label
valuenumber | bigint | stringcomputedOverride the computed subtotal
decimalsnumberReceipt.decimalsDecimal precision for the subtotal display
maxDecimalsnumberReceipt.Price.maxDecimalsMaximum decimal places to display
abbreviatebooleanReceipt.Price.abbreviateOverride abbreviation for this row
childrenReactNodeReceipt.Price templateOverride the price rendering for this row

Receipt.Discount

Applies a discount (subtracted from total).

PropTypeDefaultDescription
labelstringrequiredDiscount description
valuenumber | bigint | stringrequiredDiscount amount
decimalsnumberReceipt.decimalsDecimal precision for this row
maxDecimalsnumberReceipt.Price.maxDecimalsMaximum decimal places to display
abbreviatebooleanReceipt.Price.abbreviateOverride abbreviation for this row
childrenReactNodeReceipt.Price templateOverride the price rendering for this row

Receipt.Fee

Adds a fee (added to total).

PropTypeDefaultDescription
labelstringrequiredFee description
valuenumber | bigint | stringrequiredFee amount
decimalsnumberReceipt.decimalsDecimal precision for this row
maxDecimalsnumberReceipt.Price.maxDecimalsMaximum decimal places to display
abbreviatebooleanReceipt.Price.abbreviateOverride abbreviation for this row
childrenReactNodeReceipt.Price templateOverride the price rendering for this row

Receipt.Tax

Calculates and displays tax.

PropTypeDefaultDescription
labelstring"Tax"Row label
valuenumber | bigint | stringcomputedUse an explicit tax amount instead of calculating from rate
ratenumbernoneTax rate (e.g. 0.1 for 10%) used when value is omitted
decimalsnumberReceipt.decimalsDecimal precision for this row
maxDecimalsnumberReceipt.Price.maxDecimalsMaximum decimal places to display
abbreviatebooleanReceipt.Price.abbreviateOverride abbreviation for this row
childrenReactNodeReceipt.Price templateOverride the price rendering for this row

Receipt.Total

Displays the final total including all items, fees, discounts, and tax.

PropTypeDefaultDescription
labelstring"Total"Row label
valuenumber | bigint | stringcomputedOverride the computed total
decimalsnumberReceipt.decimalsDecimal precision for this row
maxDecimalsnumberReceipt.Price.maxDecimalsMaximum decimal places to display
abbreviatebooleanReceipt.Price.abbreviateOverride abbreviation for this row
childrenReactNodeReceipt.Price templateOverride the price rendering for this row

Receipt.Footer

Renders the receipt footer section. Accepts standard div props and className.

On this page