Vector Motion
E-Commerce

Payment Methods Card - Transaction Analysis

Monitor payment method preferences and transaction distribution. Track payment processing and alternative payment options.

Payment Methods Card

The Payment Methods Card Monitor payment method distribution and transaction counts.

Preview

Installation

ash npx shadcn@latest add https://vectormotion.vercel.app/registry/payment-methods-card.json

Payment Methods Card
'use client';import React from "react";import { CreditCard, Wallet } from "lucide-react";import { motion } from "motion/react";import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface Method {  name: string;  transactions: number;  percentage: number;  color: string;  [key: string]: any;}interface PaymentMethodsCardProps {  className?: string;  title?: string;  description?: string;  methods?: Method[];}const DEFAULT_TITLE = "Payment Methods";const DEFAULT_DESCRIPTION = "Transaction Breakdown";const DEFAULT_METHODS: Method[] = [  {    name: "Credit Card",    transactions: 1245,    percentage: 62,    color: "bg-blue-500",  },  {    name: "PayPal",    transactions: 456,    percentage: 23,    color: "bg-indigo-500",  },  {    name: "Apple Pay",    transactions: 198,    percentage: 10,    color: "bg-zinc-800",  },  { name: "Other", transactions: 101, percentage: 5, color: "bg-zinc-400" },];export const PaymentMethodsCard: React.FC<PaymentMethodsCardProps> = ({  className = "",  title = DEFAULT_TITLE,  description = DEFAULT_DESCRIPTION,  methods = DEFAULT_METHODS,}) => {  const isInteractive = true;  const index = 9;  const totalTransactions = methods.reduce((sum, m) => sum + m.transactions, 0);  return (    <motion.div      layoutId={isInteractive ? `card-${index}-${title}` : undefined}      transition={{ duration: 0.4, ease: "easeOut" }}      className={cn(        "relative overflow-hidden rounded-xl border border-border bg-card text-card-foreground p-6 shadow-sm transition-all flex flex-col group",        isInteractive          ? "cursor-pointer hover:border-zinc-300 dark:hover:border-zinc-700"          : "",        className,      )}    >      <div className="mb-4 flex items-start justify-between relative z-10">        <div>          <h3 className="font-semibold text-lg tracking-tight text-foreground">            {title}          </h3>          {description && (            <p className="text-sm text-muted-foreground mt-1">{description}</p>          )}        </div>        <div className="rounded-full bg-zinc-100 dark:bg-zinc-800 p-2 text-foreground flex items-center justify-center">          <CreditCard className="h-5 w-5 text-indigo-500" />        </div>      </div>      <div className="relative z-10 flex-1">        <div className="text-2xl font-bold text-foreground mb-1">          {totalTransactions.toLocaleString()}        </div>        <p className="text-sm text-muted-foreground mb-4">Total Transactions</p>        <div className="flex gap-1 h-3 rounded-full overflow-hidden mb-4">          {methods.map((method, idx) => (            <motion.div              key={idx}              initial={{ width: 0 }}              animate={{ width: `${method.percentage}%` }}              transition={{ duration: 0.8, delay: idx * 0.1 }}              className={method.color}              title={method.name}            />          ))}        </div>        <div className="space-y-2">          {methods.map((method, idx) => (            <div key={idx} className="flex items-center justify-between">              <div className="flex items-center gap-2">                <div className={`w-3 h-3 rounded-full ${method.color}`}></div>                <span className="text-sm text-foreground">{method.name}</span>              </div>              <div className="flex items-center gap-2">                <span className="text-sm font-medium text-foreground">                  {method.transactions}                </span>                <span className="text-xs text-muted-foreground">                  ({method.percentage}%)                </span>              </div>            </div>          ))}        </div>      </div>    </motion.div>  );};

Usage

This component is a data-rich dashboard card displaying e-commerce metrics with animated visualizations and dark mode support. Perfect for dashboards, landing pages, and analytics interfaces.

Prop

Type