Credit Card Input
Card number, expiry and CVC with brand detection and Luhn validation.
Import
tsx
import { CreditCardInput } from "@cooud-ui/ui";
bash
npx cooud-ui add credit-card-input
Examples
API Reference
Generated from the component's exported types.
CreditCardInputProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "onChange">
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | "Credit card" | Accessible group label announced to assistive tech. |
defaultNumber | string | — | Uncontrolled initial card number (digits or already-spaced). |
onChange | (value: CreditCardValue) => void | — | Fires on every keystroke with the parsed, validated card value. Display-side only — do not persist, log, or transmit the raw PAN/CVC. |
invalid | boolean | false | Forces the invalid styling and sets `aria-invalid` on every field. |
disabled | boolean | false | Disables all three fields. |
error | string | — | Optional error message rendered under the group with `role="alert"`. |