opensourceui
GitHubTwitter/X
  1. Home
  2. Components
  3. Users
  4. Credit Card Glass
Back to Users

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

Platinum

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. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/users/credit-card-glass.tsx in your project.

  4. 4

    Import and render:

    Example

    import { CreditCardGlass } from "@/components/users/credit-card-glass";

    <CreditCardGlass />

lib/cn.ts

1
2
3
4
5
6
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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,
) => (
<div
ref={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 */}
<div
data-slot="credit-card-glass-background"
className="absolute inset-0 bg-linear-to-br from-neutral-800 via-neutral-900 to-black"
/>
 
{/* Glow Effects */}
<div
data-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"
/>
 
<div
data-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 */}
<div
data-slot="credit-card-glass-content"
className="relative z-10 flex h-full flex-col justify-between p-5"
>
{/* Top Section */}
<div
data-slot="credit-card-glass-header"
className="flex items-start justify-between"
>
<div
data-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 */}
<div
data-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";
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/users/credit-card-glass.tsx

Sponsor spot · demo preview

Logo

Your brand name

Your tagline or category

A short pitch about your product or service goes here. This is a preview of how sponsor cards will look in this sidebar.

Your call to action

This slot is available. Sponsor Opensource UI and reach developers browsing components every day.