Formify Docs

Credit Card

Group card digits into blocks of four as the user types

Credit Card

The creditCard formatter groups card digits into blocks of four, separated by spaces, as the user types.

Usage

validationSchema: {
  card: { format: "creditCard" },
}

Result

TypedResult
42424242424242424242 4242 4242 4242

Things to know

  • Pair with the creditCard validator (creditCard: true) for the Luhn checksum check.

On this page