Magnetic Stripe Swipe Card
A card that reacts to a magnetic swipe gesture. Hovering near the magnetic stripe causes a rainbow shimmer to travel across the card face. Clicking simulates a swipe animation with a glowing magnetic read head tracing the stripe.
Magnetic Stripe Swipe Card
by FreeCsStyles Dev's
CardsSpin / Rotation / Flip
🌐HTML/CSS🎨Tailwind⚛️React💚Vue🅰️Angular🔥Svelte☁️LWC
#magnetic#swipe#stripe#credit-card#shimmer#rainbow#payment#iridescent#glow#card
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/magnetic-swipe-card.
<iframe src="/embed/magnetic-swipe-card" sandbox="allow-scripts" loading="lazy" title="Magnetic Stripe Swipe Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Magnetic Stripe Swipe Card, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.
HTML
<div class="mag-swipe-card">
<div class="mag-stripe"></div>
<div class="mag-content">
<div class="mag-chip"></div>
<div class="mag-number">•••• •••• •••• 7654</div>
<div class="mag-holder">JORDAN RILEY</div>
<div class="mag-expiry">06/27</div>
</div>
<div class="mag-read-head"></div>
</div>CSS
.mag-swipe-card { position: relative; width: 220px; min-height: 290px; border-radius: 12px; background: linear-gradient(145deg, #1e1024, #0e0814); border: 1.5px solid rgba(180,120,200,0.15); overflow: hidden; cursor: pointer; }
.mag-swipe-card:hover { box-shadow: 0 0 30px rgba(147,51,234,0.15); }
.mag-stripe { position: absolute; right: 0; top: 10%; width: 8px; height: 55%; background: linear-gradient(180deg, #9333ea, #d946ef); border-radius: 4px; transition: all 0.3s; }
.mag-swipe-card:hover .mag-stripe { box-shadow: 0 0 20px rgba(147,51,234,0.6), 0 0 60px rgba(147,51,234,0.3); }
.mag-chip { width: 36px; height: 26px; background: linear-gradient(135deg, #c4955a, #a07040); border-radius: 4px; }
.mag-number { font-size: 17px; font-weight: 700; color: rgba(255,255,255,0.85); margin-top: 28px; letter-spacing: 2px; }
.mag-holder { font-size: 11px; color: rgba(255,255,255,0.55); text-transform: uppercase; margin-top: 4px; }
.mag-expiry { font-size: 10px; color: rgba(255,255,255,0.35); }
.mag-read-head { position: absolute; right: 0; top: -10px; width: 8px; height: 8px; border-radius: 50%; background: #a855f7; opacity: 0; transition: all 0.5s; }
.mag-swipe-card:hover .mag-read-head { top: 10%; opacity: 1; }Tailwind CSS
<div class="group relative w-[220px] min-h-[290px] rounded-xl bg-gradient-to-br from-[#1e1024] to-[#0e0814] border border-purple-500/20 overflow-hidden cursor-pointer group-hover:shadow-[0_0_30px_rgba(147,51,234,0.15)]">
<div class="absolute right-0 top-[10%] w-[8px] h-[55%] bg-gradient-to-b from-purple-600 to-pink-500 rounded transition-all group-hover:shadow-[0_0_20px_rgba(147,51,234,0.6)]"></div>
<div class="p-5">
<div class="w-9 h-6.5 rounded bg-gradient-to-br from-amber-500 to-amber-700"></div>
<div class="text-lg font-bold text-white/85 tracking-wider mt-7">•••• •••• •••• 7654</div>
<div class="text-xs text-white/55 uppercase mt-1">JORDAN RILEY</div>
<div class="text-[10px] text-white/35 mt-0.5">06/27</div>
</div>
<div class="absolute right-0 w-[8px] h-[8px] rounded-full bg-purple-500 opacity-0 transition-all group-hover:top-[10%] group-hover:opacity-100"></div>
</div>React
import React, { useRef, useState } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';
export function MagneticSwipeCard({ width = 220 }) {
const ref = useRef(null);
const [isHovered, setIsHovered] = useState(false);
const x = useMotionValue(0);
const y = useMotionValue(0);
const rotateX = useSpring(y, { damping: 25, stiffness: 250 });
const rotateY = useSpring(x, { damping: 25, stiffness: 250 });
const handleMouseMove = (e) => {
if (!ref.current) return;
const rect = ref.current.getBoundingClientRect();
x.set(-((e.clientX - rect.left - rect.width / 2) / (rect.width / 2)) * 8);
y.set(((e.clientY - rect.top - rect.height / 2) / (rect.height / 2)) * 8);
};
return (
<div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
<motion.div ref={ref} onMouseMove={handleMouseMove} style={{ rotateX, rotateY, transformStyle: 'preserve-3d' }} className="relative cursor-pointer">
<motion.div className="relative overflow-hidden rounded-xl" style={{ width, minHeight: 290, background: 'linear-gradient(145deg, #1e1024, #0e0814)', border: '1.5px solid rgba(180,120,200,0.15)' }}
animate={{ boxShadow: isHovered ? '0 0 30px rgba(147,51,234,0.15)' : '0 8px 24px rgba(0,0,0,0.3)' }}>
<motion.div className="absolute right-0 top-[10%] w-2 h-[55%] rounded" style={{ background: 'linear-gradient(180deg, #9333ea, #d946ef)' }}
animate={{ boxShadow: isHovered ? '0 0 20px rgba(147,51,234,0.6)' : 'none' }} />
<div className="p-5 space-y-1">
<div className="w-9 h-6 rounded" style={{ background: 'linear-gradient(135deg, #c4955a, #a07040)' }}></div>
<div className="text-lg font-bold tracking-wider mt-7" style={{ color: 'rgba(255,255,255,0.85)' }}>•••• •••• •••• 7654</div>
<div className="text-xs uppercase" style={{ color: 'rgba(255,255,255,0.55)' }}>JORDAN RILEY</div>
<div className="text-[10px]" style={{ color: 'rgba(255,255,255,0.35)' }}>06/27</div>
</div>
</motion.div>
</motion.div>
</div>
);
}Where Magnetic Stripe Swipe Card fits
- Credit Cards
- Gift Cards
- Payment UI
- Loyalty Cards
- Security Badges
Interaction states & animations
- Magnetic stripe shimmer sweep
- Rainbow iridescence
- Swipe glow trace
- Magnetic field particles
- Read head tracking
Topics
- #magnetic
- #swipe
- #stripe
- #credit-card
- #shimmer
- #rainbow
- #payment
- #iridescent
- #glow
- #card
Accessibility notes
Shimmer animation can be disabled with prefers-reduced-motion. Card text remains readable without animations.
Browser support
- Chrome 76+
- Firefox 90+
- Safari 13+
- Edge 79+