Spotlight Card
wise-ui/spotlight-cardFreeComponent
A card with a spotlight effect that follows the cursor.
Live preview
live · rendered by the registry
Rendered by wise-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://wise-ui.com/r/spotlight-card.jsonSource
1"use client"23import * as React from "react"4import { motion, useMotionValue, useMotionTemplate } from "motion/react"5import { cn } from "@/registry/wise-ui/lib/utils"67interface SpotlightCardProps {8 spotlightColor?: string9 spotlightSize?: number10 children: React.ReactNode11 className?: string12}1314function SpotlightCard({15 spotlightColor = "rgba(255,255,255,0.08)",16 spotlightSize = 200,17 children,18 className,19}: SpotlightCardProps) {20 const mouseX = useMotionValue(0)21 const mouseY = useMotionValue(0)22 const [isHovered, setIsHovered] = React.useState(false)2324 const background = useMotionTemplate`radial-gradient(${spotlightSize}px circle at ${mouseX}px ${mouseY}px, ${spotlightColor}, transparent 80%)`2526 function handleMouseMove(e: React.MouseEvent<HTMLDivElement>) {27 const rect = e.currentTarget.getBoundingClientRect()28 mouseX.set(e.clientX - rect.left)29 mouseY.set(e.clientY - rect.top)30 }3132 return (33 <div34 className={cn(35 "group relative overflow-hidden rounded-xl border border-border bg-card",36 className37 )}38 onMouseMove={handleMouseMove}39 onMouseEnter={() => setIsHovered(true)}40 onMouseLeave={() => setIsHovered(false)}41 >42 <motion.div43 className="pointer-events-none absolute inset-0 z-10 transition-opacity duration-300"44 style={{ background, opacity: isHovered ? 1 : 0 }}45 />46 <div className="relative z-20">{children}</div>47 </div>48 )49}50SpotlightCard.displayName = "SpotlightCard"5152export { SpotlightCard }53export type { SpotlightCardProps }
What it pulls in
npm packages
Files it writes
More from wise-ui
All 20 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Tabsanimated-tabs | wise-ui | Components | Free | 3 deps | |
| Border Beamborder-beam | wise-ui | Components | Free | 3 deps | |
| Data Tabledata-table | wise-ui | Components | Free | 3 deps | |
| Dockdock | wise-ui | Components | Free | 3 deps | |
| Dot Matrixdot-matrix | wise-ui | Components | Free | 2 deps | |
| Editable Texteditable-text | wise-ui | Components | Free | 4 deps | |
| Gradient Sidebargradient-sidebar | wise-ui | Components | Free | 3 deps | |
| Kanban Boardkanban-board | wise-ui | Components | Free | 6 deps |
