B

Payment Method

A composable card for displaying saved payment methods like credit cards.

•••• 4242Expires 12/26
Default

Installation

npx shadcn@latest add "https://billui.com/r/payment-method.json"
components/ui/payment-method.tsx
import { cva, type VariantProps } from "class-variance-authority";
import { CreditCard, MoreHorizontal, Pencil, Trash2 } from "lucide-react";
import * as React from "react";
import { cn } from "@/lib/utils";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";

// ... component code

Examples

Card Brands

Each card brand displays with its official logo.

•••• 4242Expires 12/26
•••• 5555Expires 08/25
•••• 0001Expires 03/27

Selected State

Use the selected variant to highlight the active payment method.

•••• 4242Expires 12/26
Default
•••• 5555Expires 08/25

Expired Card

Show expired cards with visual indication.

•••• 1234Expires 01/23 (Expired)

With Actions

Include edit, delete, or more options buttons.

•••• 8888Expires 06/28

API Reference

PaymentMethod

The root container for the payment method card.

PropTypeDefaultDescription
variant"default" | "selected""default"Visual style variant

PaymentMethodIcon

Displays the card brand logo (SVGs embedded inline for easy distribution).

PropTypeDefaultDescription
brand"visa" | "mastercard" | "amex" | "generic""generic"Card brand

PaymentMethodNumber

Displays the masked card number.

PropTypeDefaultDescription
last4string-Last 4 digits of the card

PaymentMethodExpiry

Displays the card expiration date.

PropTypeDefaultDescription
monthnumber-Expiration month (1-12)
yearnumber-Expiration year
expiredbooleanfalseShows expired indicator

PaymentMethodAction

Action button for the payment method.

PropTypeDefaultDescription
action"edit" | "delete" | "more""more"Type of action

On this page