Ship-It Designv0.0.20

GitHub

PriceBreakdown

Labelled line items with optional subLabel, originalAmount strike-through, and a totals row. For booking summaries, checkout sheets, trip receipts.

You can either pass an items array for the simple case or compose with <PriceBreakdown.Line> children when you need custom rows interleaved with the data ones.

Default#

Loading…

Promo / discount#

originalAmount renders a strike-through in the sale semantic token. Setting discount on the amount paints it in saleText.

Loading…

Line item (PriceBreakdownItem)#

Each entry in items (or the props on <PriceBreakdown.Line>).

  • label: ReactNode (required) — primary label on the left.
  • subLabel?: ReactNode — small muted secondary line under the label (e.g. "$89 × 3 nights" under "Trip price").
  • amount: ReactNode (required) — right-aligned amount column. Pre-formatted ("$267", "−$25").
  • originalAmount?: ReactNode — strike-through original price shown next to the amount in the sale color. Use for promos that reveal "was X, now Y".
  • discount?: boolean — when true, the amount renders in the saleText color (the design system's discount color). Use for the discount line itself (typically a negative amount).

Composition#

tsx
<PriceBreakdown total="$316" currency="USD">
  <PriceBreakdown.Line label="Trip price" subLabel="$89 × 3 nights" amount="$267" />
  <PriceBreakdown.Line label="Trip discount" amount="−$25" discount />
  <PriceBreakdown.Line label="Service fee" amount="$32" />
</PriceBreakdown>

Props#

PriceBreakdown#

Props for PriceBreakdown
PropTypeDefaultDescription
itemsreadonly PriceBreakdownItem[] | undefinedLine items rendered in order.
totalReactNodeFinal total. Pre-formatted (e.g. `$267`).
totalLabelReactNodeLabel for the total row. Default `'Total'`.
currencyReactNodeCurrency hint shown next to the total.
childrenReactNodeOptional bespoke children — use instead of `items` for custom rows.

PriceBreakdown.Line#

Props for PriceBreakdownLine
PropTypeDefaultDescription
classNamestring | undefined
label *ReactNode
subLabelReactNodeOptional secondary text (e.g. `$89 × 3 nights`).
amount *ReactNode
originalAmountReactNodeWhen set, renders the amount with a strike-through in the `sale` token.
discountboolean | undefinedWhen true, renders the amount in the `sale` color (e.g. discounts).