Payment Card

Payment card input automatically detects the card type, shows the icon and formats the number accordingly. It supports following brands:

Card Type
Example Number
American Express
378282246310005
Diners Club
36259600000004
Discover
6011111111111117
ELO
6550000000000001
JCB
3530111333300000
Maestro
6304000000000000
Mastercard
5555555555554444
UnionPay
6246729687894613
Visa
4111111111111111

The card-validator library is used to determine the card format. It's also re-exported from baseui/payment-card as {valid} in case you need more meta-data about the card.

This component is based on input and shares the most of its APIs.

Controlled usage



Uncontrolled usage

Default value

Additionally, you can fully customize any part of the Payment Card through the overrides prop. The Payment Card consists of multiple subcomponents that are listed bellow and you can override each one of them. To help you identify the names of these subcomponents, you can highlight them through this selector:

Note: You should always use longhand CSS properties. Mixing shorthands and longhands will lead into strange behaviors!

PaymentCard API

Warning any = "Prop types are not shown in dev mode"

extract-react-types is not being run in dev mode for speed reasons. If you need to see prop types add the environment variable FORCE_EXTRACT_REACT_TYPES eg:

  • FORCE_EXTRACT_REACT_TYPES=true yarn start <packageName>
  • FORCE_EXTRACT_REACT_TYPES=true yarn start:<team>