Skip to content
synccn

Card Input

New

Card number, expiry and CVC with brand detection and Luhn check.

Payments are encrypted.

Try the test number 4242 4242 4242 4242 with any future date.

Installation

$ pnpm dlx shadcn@latest add @synccn/card-input

First time in this project? Connect synccn with one command.

Usage

import { CardInput } from "@/components/ui/card-input";<CardInput onChange={({ complete }) => …} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

CardInput

Card number, expiry and CVC in one field. Detects the brand, formats as you type, checks the number with the Luhn algorithm and moves focus forward. This is UI only: send card details to your payment provider, never your own server.

  • onChange
    (state: { brand?: string; complete: boolean }) => void

    Called on every change with the detected brand and whether all fields look valid.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA attributes: aria-label