Components / Users
Credit Card Glass
Free Users React component — CreditCardGlass. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.
Glassmorphism payment card with chip, masked number, holder name, and expiry. Glow on hover — fintech landing pages eat this up.
Preview
4532 •••• •••• 7891
Card Holder
Bidyut Kundu
Expires
09/28
Setup
How to use
Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.
- 1
Run in your terminal:
$npm install clsx tailwind-merge lucide-react - 2
Copy
lib/cn.tsbelow. Skip if you already havecn(). - 3
Copy the code below and create
components/users/credit-card-glass.tsxin your project. - 4
Import and render:
Exampleimport { CreditCardGlass } from "@/components/users/credit-card-glass";
lib/cn.ts
import { type ClassValue, clsx } from "clsx";import { twMerge } from "tailwind-merge";export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));}
components/users/credit-card-glass.tsx
import { forwardRef, type ComponentPropsWithoutRef } from "react";import { cn } from "@/lib/cn";export type CreditCardGlassProps = Readonly<{holderName?: string;cardNumber?: string;expiryDate?: string;tier?: string;} & ComponentPropsWithoutRef<"div">>;// Production-ready Credit Card Glass component — styled with Tailwind CSS.export const CreditCardGlass = forwardRef<HTMLDivElement, CreditCardGlassProps>(({className,holderName = "Bidyut Kundu",cardNumber = "4532 •••• •••• 7891",expiryDate = "09/28",tier = "Platinum",...props},ref,) => (<divref={ref}data-slot="credit-card-glass"className={cn("group relative h-48 w-80 cursor-pointer overflow-hidden rounded-2xl font-sans",className,)}{...props}>{/* Background */}<divdata-slot="credit-card-glass-background"className="absolute inset-0 bg-linear-to-br from-neutral-800 via-neutral-900 to-black"/>{/* Glow Effects */}<divdata-slot="credit-card-glass-glow-top"className="absolute top-[-20%] right-[-10%] h-40 w-40 rounded-full bg-teal-500/30 blur-[50px] transition-colors duration-700 group-hover:bg-teal-500/40"/><divdata-slot="credit-card-glass-glow-bottom"className="absolute bottom-[-30%] left-[-10%] h-48 w-48 rounded-full bg-cyan-500/20 blur-[60px]"/>{/* Card Content */}<divdata-slot="credit-card-glass-content"className="relative z-10 flex h-full flex-col justify-between p-5">{/* Top Section */}<divdata-slot="credit-card-glass-header"className="flex items-start justify-between"><divdata-slot="credit-card-glass-chip"className="h-7 w-10 rounded-md bg-linear-to-br from-amber-300 to-amber-500 opacity-90"/><span className="font-mono text-[10px] tracking-[0.2em] text-white/40 uppercase">{tier}</span></div>{/* Bottom Section */}<div data-slot="credit-card-glass-details"><p className="mb-3 font-mono text-lg tracking-[0.15em] text-white/90">{cardNumber}</p><div className="flex items-end justify-between"><div><p className="mb-0.5 font-mono text-[8px] tracking-widest text-white/30 uppercase">Card Holder</p><p className="text-xs font-medium tracking-wider text-white/80 uppercase">{holderName}</p></div><div className="text-right"><p className="mb-0.5 font-mono text-[8px] tracking-widest text-white/30 uppercase">Expires</p><p className="font-mono text-xs text-white/80">{expiryDate}</p></div>{/* Payment Network */}<divdata-slot="credit-card-glass-network"className="flex -space-x-2"><div className="h-7 w-7 rounded-full bg-red-500/80 opacity-90" /><div className="h-7 w-7 rounded-full bg-amber-500/80 opacity-90" /></div></div></div></div></div>),);CreditCardGlass.displayName = "CreditCardGlass";