Loading effect…
Loading preview…
cards · react · free
A card whose soft spotlight follows the pointer on hover.
import { SpotlightCard } from "@/components/znverse/spotlight-card/SpotlightCard";
<SpotlightCard size={220} color="#6366f1" intensity={0.18}>
Your content
</SpotlightCard>npx znverse add spotlight-card"use client";
import {
useCallback,
useEffect,
useRef,
useState,
type CSSProperties,
type PointerEvent,
type ReactNode,
} from "react";
type SpotlightCardProps = {
children?: ReactNode;
className?: string;
size?: number;
color?: string;
intensity?: number;
};
A card whose soft spotlight follows the pointer on hover.
Copy src/SpotlightCard.tsx into your React project. No extra dependencies.
import { SpotlightCard } from "./SpotlightCard";
export function Example() {
return (
<SpotlightCard>
<h3>Hover me</h3>
<p>The light follows your pointer.</p>
</SpotlightCard>
);
}| Prop | Type | Default | What it does |
|---|---|---|---|
size | number | 220 | Spotlight diameter in pixels |
color | string | "#6366f1" | Spotlight colour as #rrggbb |
intensity | number | 0.18 | Spotlight opacity from 0 to 1 |
className | string | Extra class on the card |
"use client")prefers-reduced-motion (static soft glow instead)