Tally UI

DiscountForm

Percentage or fixed-amount discount entry with Apply and Cancel actions

Import

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

Usage

<DiscountForm
  title="Order discount"
  currency={sale.order.currency}
  onApply={(discount) => sale.applyDiscount(null, discount)}
  onClose={() => setDiscountOpen(false)}
/>

Renders a title, percentage or fixed-amount selector, discount input, and Apply and Cancel buttons. Parsing errors and refusals from onApply appear inline; a successful application closes the form through onClose.

Props

PropTypeDefaultDescription
titlestringrequiredHeading and accessible group label
currencystringrequiredCurrency used to parse fixed amounts into minor units and label the amount input
onApply(discount: Discount) => string | nullrequiredReceives the parsed discount; return a refusal to show inline or null once applied
onClose() => voidrequiredCalled on Cancel or after onApply returns null

On this page