Testimonial Spotlight
ncdai/testimonial-spotlightUnverifiedComponent
Testimonial card with spotlight effect on hover.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/exekartik/exeKartik/main/testimonial-spotlight.jsonSource
1"use client"23import { useRef } from "react"45import { cn } from "@/lib/utils"67export type TestimonialSpotlightProps = Omit<8 React.ComponentPropsWithoutRef<"div">,9 "children" | "onMouseMove"10> & {11 children: React.ReactNode12}1314export function TestimonialSpotlight({15 children,16 className,17 ...props18}: TestimonialSpotlightProps) {19 const itemRef = useRef<HTMLDivElement>(null)2021 const handleMouseMove: React.MouseEventHandler<HTMLDivElement> = (e) => {22 if (!itemRef.current) return2324 const rect = itemRef.current.getBoundingClientRect()2526 itemRef.current.style.setProperty(27 "--spotlight-x",28 `${e.clientX - rect.left}px`29 )30 itemRef.current.style.setProperty(31 "--spotlight-y",32 `${e.clientY - rect.top}px`33 )34 }3536 return (37 <div38 ref={itemRef}39 data-slot="testimonial-spotlight"40 className={cn(41 "group/testimonial-spotlight relative overflow-hidden rounded-xl bg-card/50 inset-ring-1 inset-ring-foreground/10",42 className43 )}44 onMouseMove={handleMouseMove}45 {...props}46 >47 <div48 className="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-500 ease-in-out group-hover/testimonial-spotlight:opacity-(--spotlight-opacity,0.5)"49 style={{50 background: `radial-gradient(circle at var(--spotlight-x) var(--spotlight-y), var(--spotlight-color,rgba(255,255,255,0.2)), transparent var(--spotlight-size,60%))`,51 }}52 />53 {children}54 </div>55 )56}
What it pulls in
Other registry items
Files it writes
More from ncdai
All 17 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Apple Hello Effectapple-hello-effect | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Hindiapple-hello-effect-hindi | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Spanishapple-hello-effect-spanish | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Vietnameseapple-hello-effect-vietnamese | ncdai | Components | Unverified | 1 dep | |
| Brand Assets Menubrand-assets-menu | ncdai | Components | Unverified | 1 dep | |
| chevrons-up-down-iconchevrons-up-down-icon | ncdai | Components | Unverified | 1 dep | |
| Code Block Commandcode-block-command | ncdai | Components | Unverified | 4 deps · 3 files | |
| Consent Managerconsent-manager | ncdai | Components | Unverified | 1 dep · 2 files |
