# Payment card

A plastic payment card at real proportions. Use it on its own, as a radio in a picker, or inside a Wallet.

- Category: Money
- Part of: Wallet (https://bevel-ui.vercel.app/components/wallet.md)
- Docs: https://bevel-ui.vercel.app/components/wallet/payment-card
- Import from: `@/components/ui/payment-card`

## Install

```bash
npx shadcn@latest add @bevel/payment-card
```

npm dependencies (installed by the CLI): `@base-ui/react`, `cn`.

## Anatomy

```tsx
<PaymentCard>
  <PaymentCardBrand />
  <PaymentCardNumber />
  <PaymentCardChip />
</PaymentCard>
```

## Parts

| Part | Renders | Description |
| --- | --- | --- |
| `PaymentCard` | div | The card, at ID-1 proportions (85.60 × 53.98 mm). tone picks sapphire, gold or graphite. Pass render={<Radio.Root value="…" />} to make it selectable. |
| `PaymentCardBrand` | span | The card's mark. Text by default; put your own SVG logo inside. |
| `PaymentCardNumber` | span | last4 shown as •••• 4242 and read as “ending in 4242”. |
| `PaymentCardChip` | span | The metal contact chip. Decorative and hidden from screen readers. |

## Example: Saved payment methods

Cards as a radio group, without a wallet. The chosen card lifts; arrow keys move between them.

```tsx
"use client"

import { Radio } from "@base-ui/react/radio"
import { RadioGroup } from "@base-ui/react/radio-group"
import {
  PaymentCard,
  PaymentCardBrand,
  PaymentCardChip,
  PaymentCardNumber,
  type PaymentCardTone,
} from "@/components/ui/payment-card"

const cards: { id: string; brand: string; last4: string; tone: PaymentCardTone }[] = [
  { id: "visa-4242", brand: "Visa", last4: "4242", tone: "graphite" },
  { id: "amex-1005", brand: "Amex", last4: "1005", tone: "sapphire" },
  { id: "debit-8210", brand: "Debit", last4: "8210", tone: "gold" },
  { id: "corp-7731", brand: "Corporate", last4: "7731", tone: "graphite" },
]

export function PaymentCardPicker() {
  return (
    <RadioGroup aria-label="Pay with" defaultValue="visa-4242" className="grid grid-cols-2 gap-4">
      {cards.map((card) => (
        <PaymentCard
          key={card.id}
          tone={card.tone}
          render={<Radio.Root value={card.id} />}
          className="cursor-pointer transition-[translate,filter] duration-(--bevel-duration-small) ease-(--bevel-ease-out) not-data-checked:brightness-(--bevel-dim) data-checked:-translate-y-1.5 motion-reduce:transition-none"
        >
          <PaymentCardBrand>{card.brand}</PaymentCardBrand>
          <PaymentCardNumber last4={card.last4} />
          <PaymentCardChip />
        </PaymentCard>
      ))}
    </RadioGroup>
  )
}
```
