Skip to main content

<primer-input-card-number>

Secure, PCI-compliant input for card numbers. Automatically detects and displays card network (Visa, Mastercard, etc.) as user types.

Quick Reference


Examples

Default

Custom Labels

No Placeholder

In Custom Layout


Properties

Setting to empty string "":
  • label: Reverts to default
  • placeholder: Shows no placeholder
  • aria-label: Uses label value

Card Network Detection

Automatically detects: Displays network logo and adjusts formatting (e.g., Amex uses different spacing).

Validation

Validates:
  • Number length matches detected network (e.g., 16 for Visa, 15 for Amex)
  • At least one digit entered
Errors display automatically on submit or blur.

Events

<primer-input-card-number> does not emit its own events. Validation and submission are managed by the parent <primer-card-form>.

Relevant Parent Events

Reacting to card validation errors


CSS Properties

This component uses the shared Input Styling Tokens.

Layout

Typography

Colors

Border & Background

Animation


States


Usage Guidelines

Do

  • Place inside <primer-card-form>
  • Use for card number collection only

Don’t

  • Don’t use <primer-card-network-selector> separately (internal component)
  • Don’t place outside card form context

Content Guidelines

Label

Placeholder

Error messages


See also

primer-card-form

Parent container

primer-input-card-expiry

Expiry input

primer-input-cvv

CVV input