Quantity breaks: a unit price that drops at set quantities, the tier the current quantity falls in highlighted, the unit price and total, and how many more units reach the next price. A table with range, unit price and saving, or a ladder of descending steps; tiers can set the quantity.
| Quantity | Price per case | Saving |
|---|---|---|
| Your price | $52.00 | — |
| $48.00 | −8% | |
| $45.00 | −13% | |
| $41.50 | −20% |
2 more for $48.00 per case.
Installation
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";
Usage
import { TierPricing } from "@vamos-ui/react";
<TierPricing
unit="case"
tiers={[{ min: 1, price: 52 }, { min: 10, price: 48, label: "Trade" }, { min: 60, price: 41.5, label: "Pallet" }]}
quantity={cases}
onQuantityChange={setCases}
quantityInput
/>The active tier carries aria-current and a "Your price" tag in text, not only the highlight.
The next-break hint is a polite live region, so changing the quantity announces "8 more for $45.00 per case."
Examples
Ladder
variant="ladder": descending steps; each step is a button that jumps to its minimum.
You save $72.00.260 more for $1.85 per label.
API
TierPricing
| Prop | Type | Default |
|---|---|---|
tiers{ min, price, label? }. Sorted by min; a tier runs to the next min − 1, the last is open-ended. | PriceTier[] | — |
quantity / defaultQuantity / onQuantityChangeWith onQuantityChange (or quantityInput) every tier sets the quantity to its minimum. | number | — |
quantityInput / maxQuantityA number field for the quantity. | boolean / number | — |
variantRows or descending steps. | "table" | "ladder" | "table" |
unitUnit word in the texts: case, box, seat. | string | label "unit" |
formatPrice / currencyDefault: provider currency, two fraction digits. | (n) => string / string | — |
showSaving / showSummarySaving column (against the first tier) and the quantity × price, total and next-break line. | boolean | true |
labelsDictionary namespace "tierPricing": caption, quantity, range, rangeOpen, unitPrice, saving, current, line, total, next, best, minimum, saved, setQuantity, unit. | Partial<TierPricingLabels> | — |
tierQuote(tiers, quantity)
| Prop | Type | Default |
|---|---|---|
returns{ index, tier, next, more, unitPrice, total, saved } — for order lines, carts and server checks. | TierQuote | — |