CreditCard

A card that tilts toward the pointer and flips to its back. The number is masked down to the last four digits. Finance.

Open playground

About

CreditCard is a React component in the Finance category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { CreditCard } from "@ashutoshswamy/smoui" and set number, name, cvc among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { CreditCard } from "@ashutoshswamy/smoui";

<CreditCard number="4242 4242 4242 8431" name="Ada Lovelace" expiry="09/29" cvc="418" />

Props 4

number

Only the last four digits show unless reveal is set.

string
name / expiry

Cardholder and MM/YY.

string
cvc

Shown on the back.

string
reveal

Show the whole number. Default false.

boolean