Payment Form
ProA complete card-checkout block. The number, expiry and CVC are masked as you type, the card brand is detected live, and the billing country shows circular flags. Accept promo codes to roll the total.
Installation#
Usage#
This example is part of Koala UI Pro
The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.
Have a license? Unlock it here
API reference#
PaymentForm
A card checkout built from Field, Input and CountrySelect. Masking and brand detection are presentation only: never store an unmasked card number. Forwards native <div> props; accepts className, merged last.
| Prop | Type | Default | Description |
|---|---|---|---|
| onSubmit | (data: PaymentFormData) => void | Promise<void> | - | Called with { cardNumber, expiry, cvc, name, country, promoCode? }, masked as shown. Return a promise to hold the spinner until it settles. |
| amount | string | - | The display total, e.g. "$49.00". Shows the summary row and labels the Pay button. |
| promoCodes | Record<string, PaymentPromoCode> | - | Accepted codes, matched case-insensitively, each { percentOff?, amountOff?, label? }. Reveals the promo row; needs a parseable amount. |
| promoHint | React.ReactNode | - | A caption under the promo field, e.g. "Try KOALA20". |
| defaultCountry | string | "US" | The billing country preselected, as ISO2. |
| title | React.ReactNode | "Payment details" | The heading above the form. |
| description | React.ReactNode | "Enter your card to complete…" | The line under the heading. |
| density | "comfortable" | "compact" | - | Spacing, 24 or 16px. Inherits the nearest DensityProvider (compact with none). |