Componentdata0.6 KB gzipZero dependencies
Spotlight Card
Card with cursor-following radial spotlight glow.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add spotlight-cardOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { SpotlightCard } from "@/components/ui/spotlight-card"; <SpotlightCard />Source code
spotlight-card.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxspotlight-card.tsx51 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface SpotlightCardProps extends React.HTMLAttributes<HTMLDivElement> { /** Spotlight radius (px) */ radius?: number;} /** Radial spotlight focus card tracking cursor position. */export function SpotlightCard({ radius = 220, className, children, ...props }: SpotlightCardProps) { const ref = React.useRef<HTMLDivElement>(null); const [pos, setPos] = React.useState({ x: -999, y: -999 }); const [hover, setHover] = React.useState(false); const handleMove = (e: React.MouseEvent) => { const rect = ref.current?.getBoundingClientRect();Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { SpotlightCard } from "@/components/ui/spotlight-card"; <SpotlightCard />| Prop | Type | Description |
|---|---|---|
| radius | number | Spotlight radius (px) |