← All components
Glow Card
A card with a spotlight that follows the cursor, using two CSS variables and a radial gradient.
hover me
Glow Card
The light follows your cursor. One component, zero dependencies.
Install
terminal
npx shadcn@latest add https://sprintslab.xyz/r/glow-card.jsonOr copy the component into your project:
glow-card.tsx
"use client";
import * as React from "react";
export function GlowCard({ children, className = "" }: { children: React.ReactNode; className?: string }) {
const onMove = (e: React.MouseEvent<HTMLDivElement>) => {
const r = e.currentTarget.getBoundingClientRect();
e.currentTarget.style.setProperty("--x", `${e.clientX - r.left}px`);
e.currentTarget.style.setProperty("--y", `${e.clientY - r.top}px`);
};
return (
<div
onMouseMove={onMove}
className={`rounded-2xl border border-white/10 p-6 ${className}`}
style={{
background:
"radial-gradient(300px circle at var(--x, 50%) var(--y, 50%), rgba(197, 243, 107, 0.18), transparent 70%), #18181b",
}}
>
{children}
</div>
);
}
Usage
usage
import { GlowCard } from "@/components/glow-card";
<GlowCard>
<h3>Glow Card</h3>
<p>Move your cursor over me.</p>
</GlowCard>