Skip to content
Forms

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">

PropTypeDefaultDescription
label
string"Credit card"Accessible group label announced to assistive tech.
defaultNumber
stringUncontrolled initial card number (digits or already-spaced).
onChange
(value: CreditCardValue) => voidFires on every keystroke with the parsed, validated card value. Display-side only — do not persist, log, or transmit the raw PAN/CVC.
invalid
booleanfalseForces the invalid styling and sets `aria-invalid` on every field.
disabled
booleanfalseDisables all three fields.
error
stringOptional error message rendered under the group with `role="alert"`.