Payment Input
Card number, expiry, CVC, and IBAN fields built on InputGroup. Formatting is display-only — onValueChange always gets compact raw values (digits or alphanumeric IBAN). Includes Luhn, brand detection, and IBAN mod-97.
Gallery
Card number, expiry, and CVC together. Brand updates from BIN prefixes; Luhn gates completeness.
Loading…
Installation
CLI
Also needs
npx @sonojs/ui@latest add input-groupUsage
payment-input.tsx
CardNumberInput
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled raw digits. |
| defaultValue | string | "" | Initial digits when uncontrolled. |
| onValueChange | (digits: string) => void | - | Fires with digits only (no spaces). |
| onBrandChange | (brand: CardBrand) => void | - | Called when BIN detection changes the brand. |
| masked | boolean | false | Mask all but last 4 while blurred. |
| showBrand | boolean | true | Show brand label in the end addon. |
| invalid | boolean | auto | Override; default uses failed Luhn when length ≥ 12. |
CardExpiryInput / CardCvcInput
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Expiry: MMYY digits. CVC: digits only. |
| onValueChange | (digits: string) => void | - | Raw digits callback. |
| brand | CardBrand | "unknown" | CVC only — Amex uses 4 digits. |
IbanInput
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled compact IBAN (no spaces). |
| onValueChange | (iban: string) => void | - | Uppercase alphanumeric without spaces. |
| showCountry | boolean | true | Show the first two letters as a start addon. |
| invalid | boolean | auto | Override; default uses failed mod-97 when length ≥ 15. |
Related
- Input Group, addon chrome used for brand and country
- Currency Input, money amounts with Intl formatting
- Field, label and describe the control