Tally UI

DiscountChips

Removable badges for applied discounts

Import

import { DiscountChips } from '@tallyui/components';

Usage

<DiscountChips
  discounts={line.discounts}
  currency={sale.order.currency}
  onRemove={sale.removeDiscount}
  amounts={sale.order.display.lines.find((row) => row.lineId === line.id)?.discounts}
/>

Renders one removable badge per applied discount, using display amounts when supplied. Pressing a badge calls onRemove with its discount ID; an empty list renders nothing.

Props

PropTypeDefaultDescription
discountsAppliedDiscount[]requiredApplied discounts to render as badges
currencystringrequiredCurrency used to format discount amounts
onRemove(id: string) => voidrequiredCalled with the pressed discount's ID
prefixstring---Text prepended to each label, such as “Order discount”
amounts{ discountId: string; amountMinor: number }[][]Figures from order.display matched by discount ID; shown alongside percentages or as the fixed discount amount

On this page