Componentdata3.49 KB gzipZero dependencies
Credit Card
Universal payment card visualizer with real-time card number formatting, brand badge detection (Visa, Mastercard, Amex), metallic EMV chip, and interactive 3D flip card to show CVV.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add credit-cardOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { CreditCard } from "@/components/ui/credit-card"; <CreditCard cardNumber="4111111111111111" cardHolder="ADA BULL" expiry="12/28" />Source code
credit-card.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxcredit-card.tsx634 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export type CardBrand = | "visa" | "mastercard" | "amex" | "discover" | "jcb" | "diners" | "generic"; export type CardVariant = "default" | "night" | "accent" | "gold" | "minimal";export type CardSize = "sm" | "md" | "lg"; export interface CreditCardProps extends React.HTMLAttributes<HTMLDivElement> {Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { detectCardBrand } from "@/components/ui/credit-card"; <detectCardBrand />| Prop | Type | Description |
|---|---|---|
| cardNumber | string | 15-19 digit card number, raw or formatted |
| cardHolder | string | Cardholder name |
| expiry | string | Expiry date string, e.g. "12/28" or "1228" |
| cvv | string | 3 or 4 digit CVV/CVC security code |
| brand | CardBrand | "auto" | Card brand override. Defaults to auto-detection from cardNumber |
| flipped | boolean | Controlled flip state (true shows the back of the card) |
| defaultFlipped | boolean | Default flip state if uncontrolled |
| onFlipChange | (flipped: boolean) => void | Callback triggered when card flip state changes |
| interactive | boolean | Enables clicking or keyboard space/enter to flip card |
| variant | CardVariant | Visual style theme variant |
| size | CardSize | Dimension scale of the card |
| maskNumber | boolean | Mask middle digits of the card number |
| issuer | string | Bank / Issuer name printed on card |
| tier | string | Custom ticket stub tier label, e.g. "VIP PASS" |
| showChip | boolean | Show the metallic EMV chip graphic |
| showContactless | boolean | Show the contactless symbol |
| className | string | Custom class names |