Credit card
Ten real-world credit cards drawn as vector art, front and back, with every printed detail editable.
npx @swipeui/cli add credit-cardWhen to use it
- A wallet or banking screen that shows the customer's card the way it looks in their hand, with their own number, name and dates, in one of ten real-world designs.
- Card selection, such as choosing which card pays, where recognising the real card design matters.
- Onboarding for a new card, showing the front and then flipping to the back with Flip card.
- A swipeable deck of saved cards with Card stack.
When not to use it
- Collecting card details. Use text fields with the platform's secure input; this card only displays.
- Showing a full number or security code to anyone but the verified cardholder. Pass masked and leave securityCode empty.
- Cards from an issuer you aren't allowed to depict. Use your own design or a plain style instead.
- A generic payment summary. A list row with the last four digits is lighter.
Installation
Installs with a Pro licence
Everything on this page is public except the source. Founder pre-sale opens around 5 January 2027.
Usage
import { CreditCard } from '@/components/swipeui/card/credit-card';
import { amexPlatinum } from '@/components/swipeui/card/designs/amex-platinum';
<CreditCard
design={amexPlatinum}
number="3782 822463 10005"
holder="Alex Morgan"
expiry="08/29"
memberSince="19"
emblem={require('@/assets/centurion.webp')}
/>;Examples
import { CreditCard } from '@/components/swipeui/card/credit-card';
import { amexPlatinum } from '@/components/swipeui/card/designs/amex-platinum';
// The back, with the number masked to its last four digits.
<CreditCard design={amexPlatinum} face="back" number={card.number} holder={card.holder} expiry={card.expiry} masked />;import { CreditCard } from '@/components/swipeui/card/credit-card';
import { chaseSapphireReserve } from '@/components/swipeui/card/designs/chase-sapphire-reserve';
import { useToast } from '@/components/swipeui/ui/toast';
// Copying shows its own small "Copied!" toast. To use your app's toast instead, turn it off.
// copyable={['expiry']} lets only the expiry be copied; copyable={false} turns copying off.
const toast = useToast();
<CreditCard
design={chaseSapphireReserve}
face="back"
number={card.number}
holder={card.holder}
expiry={card.expiry}
copyable={['number', 'expiry']}
copyToast={false}
haptics={false}
onCopy={(field) => toast.show({ title: field === 'number' ? 'Card number copied' : 'Expiry copied', tone: 'success' })}
/>;Designs
Import one design and pass it as design. Each lives in its own file, so only the cards you use ship in your app.
| Design | Import | Number printed on |
|---|---|---|
| American Express Platinum | amexPlatinum from designs/amex-platinum | Front |
| American Express Gold | amexGold from designs/amex-gold | Back |
| American Express Centurion | amexCenturion from designs/amex-centurion | Front |
| Chase Sapphire Reserve | chaseSapphireReserve from designs/chase-sapphire-reserve | Back |
| Capital One Venture X | capitalOneVentureX from designs/capital-one-venture-x | Back |
| Apple Card | appleCard from designs/apple-card | Not printed |
| Chase Freedom Unlimited | chaseFreedomUnlimited from designs/chase-freedom-unlimited | Back |
| Discover it | discoverIt from designs/discover-it | Back |
| HDFC Bank Infinia | hdfcInfinia from designs/hdfc-infinia | Back |
| Citi Double Cash | citiDoubleCash from designs/citi-double-cash | Back |
The American Express designs take an emblem: a dark medallion for the platinum and gold cards, and a light one for the black Centurion card, which blends it with a screen blend.
API reference
CreditCardProps
| Prop | Type | Default | Description |
|---|---|---|---|
design | | — | The card design, such as |
face? | | | Which side to draw. |
number | | — | Card number; separators are ignored and digits are grouped by the design. |
holder | | — | Cardholder name as printed. |
expiry | | — | Expiry as printed, such as "08/29". |
memberSince? | | — | Member-since year, for designs that print one. |
securityCode? | | — | Security code printed on the back. Display only: never log or store it. |
frontCode? | | — | Code printed on the front, for designs that print one there. |
signature? | | | Signature on the back. |
copy? | | | Replace any printed words. |
palette? | | | Override any artwork colour. |
fonts? | | | Override the system fonts used for lettering. |
emblem? | | | Front emblem, such as a portrait medallion: an image source (drawn engraved into the metal) or any node. Without one the design draws a plain engraved medallion. |
masked? | | | Hide every digit except the last four. |
sample? | | | Print the design's specimen marker. |
copyable? | | | Which printed details a long press copies: |
onCopy? | | — | Called after a copy with the field and the text copied (the number without separators). |
onCopyError? | | — | Called when the clipboard refuses the text. |
copyToast? | | | Show the small toast on the card after a copy. Turn it off to show your own from |
clipboardLabels? | | | Replace the words used when copying. |
haptics? | | | Haptic feedback when a copy succeeds or fails. |
motion? | | — | Motion for the toast. |
accessibilityLabel? | | | What a screen reader announces. |
className? | | — | Classes merged over the card container. |
style? | | — | Native style escape hatch for the card container. |
testID? | | — | Root identifier. |
Composition and behavior
- design picks a real-world card. Fronts follow each issuer's published card art; backs follow the network's standard layout.
- Every printed detail is a prop: number, holder, expiry, memberSince, frontCode, securityCode and signature, plus copy for every printed word, including the issuer line on the back.
- The number is grouped the way the design prints it (4-6-5 or 4-4-4-4). masked hides every digit except the last four, and the security code.
- emblem takes an image source, drawn engraved into the metal, or any node. The item ships no images; pass your own licensed artwork.
- palette and fonts override the design's colours and the system fonts used for lettering.
- Long-press the printed number or expiry to copy it. A small "Copied!" toast appears on the card with a success haptic. The number is copied as digits only. Copying works on whichever side prints the details; a masked number can't be copied and the security code never is. See Copy settings below to switch each part.
- A short tap is never taken by the card, so it still reaches a flip card, a stack or a pressable row around it. Screen readers get Copy card number and Copy expiry date actions on the card instead of the long press.
- The card fills its container's width at real card proportions. Use Flip card to turn it over and Card stack to swipe through several.
- It's display only. Never log or store the security code, or the values onCopy receives.
Copy settings
Every part of copying is a prop, so you choose per card what can be copied and how it's confirmed.
| Prop | Does | Default |
|---|---|---|
| copyable | true copies the number and expiry, false neither, or list the ones you want: ['number'] or ['expiry'] | true |
| copyToast | Shows the built-in "Copied!" toast; turn it off to show your own from onCopy | true |
| haptics | Plays the success or failure buzz | true |
| clipboardLabels | Replaces the toast text, the screen-reader actions and what's announced | English |
| onCopy / onCopyError | Tell you what was copied ('number' or 'expiry' and the text) or why the copy failed | none |
Behavior and gestures
- Long-press the printed card number or expiry to copy it. A small "Copied!" toast appears on the card, with a success haptic. The number is copied as digits only, without spaces.
- A short tap is never taken: it reaches whatever wraps the card, so the card can sit inside a flip card, a stack or a pressable row of your own.
- A masked number can't be copied, and the security code never is. copyable chooses what copies: true for the number and expiry (the default), false for neither, or a list such as ['expiry']. copyToast={false} hides the built-in toast so you can show your own from onCopy, and haptics={false} turns the buzz off.
- face chooses the side. Pair two cards in Flip card for a 3D turn.
- Every printed detail comes from props: number, holder, expiry, member-since year, front code, security code, signature and all printed words. masked hides the number and the security code.
Accessibility
- The card is one image element, announced as the design, the last four digits, the holder and the expiry, for example "American Express Platinum card ending in 0005, ALEX MORGAN, valid thru 08/29".
- The back is announced as the card's back and never reads the security code aloud.
- VoiceOver and TalkBack users get "Copy card number" and "Copy expiry date" as actions on the card, on whichever side prints them; the copy is announced. All words can be replaced with clipboardLabels.
- Card lettering is drawn at physical scale and doesn't grow with Dynamic Type; the spoken label carries the details.
- Pass accessibilityLabel to describe a custom design or to add context such as "Default card".
Motion
- Uses the
overlaymotion role, so it follows your app's feel. Passmotionto tune this one instance. - The "Copied!" toast fades in and out on the overlay role; under Reduce Motion it uses the short reduced fade.
- The artwork itself is static. Flip card and Card stack add motion around it.
Performance
- Each face is two SVG layers. The engraved art is static path data; grain and barcodes are generated once per card and memoised.
- An image emblem is one bitmap; pass one sized for about three times the card's on-screen width.
Notes for AI
- Import one design from ./designs and pass it as design: amexPlatinum, amexGold, amexCenturion, chaseSapphireReserve, capitalOneVentureX, appleCard, chaseFreedomUnlimited, discoverIt, hdfcInfinia or citiDoubleCash. The core never imports designs, so unused ones stay out of the bundle.
- Pass the number as a string; separators are ignored and the design groups the digits. Set masked to show only the last four.
- Never log, persist or send securityCode; it's for display to the verified cardholder only.
- Copying is on by default; copyable={['number']} or ['expiry'] limits it to one detail and copyable={false} turns it off. onCopy(field, value) reports 'number' or 'expiry'; never log or send the value. Custom designs mark where they print the details with copyTargets (boxes in 856 × 540 card units); standardBackTargets(signaturePanel) gives the boxes for StandardBack.
- emblem takes an image source (drawn engraved into the metal with a multiply blend) or any node; the item ships no images.
- Designs that print the number on the back (Gold, Sapphire Reserve, Venture X, Freedom Unlimited, Discover it, Infinia, Double Cash) show it with face="back"; Apple Card prints no number at all.
- Dark designs such as amexCenturion draw the emblem with a screen blend, so pass a light-on-dark medallion there.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.