Forms
CreditCard
A live, flippable card visual — front number/name/expiry, back magstripe/CVC — with automatic network detection. Powers `CreditCardInput`'s preview but also usable standalone to just display a card.
<UiCreditCard />Number
number is the card number, and the only prop the card reads for itself: the network is detected from it on every render, which is what sets the digit grouping, the logo and the expected CVC length. Spacing in the string doesn't matter — grouping is derived from the digits, so raw and pre-formatted values both come out right.
Visa
4242 4242 4242 4242
Mastercard
5555 5555 5555 4444
American Express
3782 822463 10005
Discover
6011 1111 1111 1117
Diners Club
3056 930902 5904
JCB
3566 0020 2036 0505
UnionPay
6212 3456 7890 1232
Purely a display component — number/name/expiry/cvc are plain strings with no formatting/validation of their own; pass already-formatted values (or raw digits, which still group correctly since grouping is derived from number regardless of spacing).
The card network is detected fresh from number on every render via exported detectCardBrand() — there's no separate brand prop, so an Amex-prefixed number automatically gets 4-6-5 grouping and a 4-digit cvc placeholder even when used standalone.
Name
name is the cardholder, printed on the front exactly as you pass it — there's no upper-casing or truncation of its own. Left empty it falls back to a “Your Name” placeholder, so a card being filled in live still looks like a card.
4242 4242 4242 4242
4242 4242 4242 4242
Expiry
expiry is the expiry date and is expected already formatted as MM/YY — the card prints the string rather than parsing it. Omitted, it shows an MM/YY placeholder in the same slot.
4242 4242 4242 4242
4242 4242 4242 4242
CVC
cvc is printed on the back of the card, so it only becomes visible once flipped is set. It's padded with • placeholders up to the length the detected brand expects — four for Amex, three for everything else.
4242 4242 4242 4242
Digits/CVC beyond what's actually passed are padded with • placeholders up to the detected brand's full length — an empty number renders as a full row of dots rather than nothing, so the card always looks like a card.
Flipped
flipped turns the card over to its back face — magnetic stripe and cvc instead of number, name and expiry. It's an ordinary boolean rather than internal state, so the card never flips on its own: drive it from a button, or from a CVC field's focus the way CreditCardInput does.
4242 4242 4242 4242
flipped is a plain boolean prop, not internal state — animate it yourself (e.g. on a button click, or CreditCardInput's CVC focus/blur) rather than expecting a built-in trigger.
The flip is a real CSS 3D transform (perspective/transform-style: preserve-3d/backface-visibility) on a fixed-aspect-ratio (85.6/54, the ISO/IEC 7810 ID-1 card ratio) box, not a cross-fade — expect the edge-on skew mid-transition if you screenshot during the 500ms animation.
Empty state — every prop omitted
•••• •••• •••• ••••
API Reference
Generated from the component's source — props, slots and emits as the component actually declares them.
Props
string''string''booleanfalseTypes
type CardBrand = "visa" | "mastercard" | "amex" | "discover" | "dinersclub" | "jcb" | "unionpay" | "unknown";