Spotlight
A soft light that follows the pointer across a container and catches the borders of the cards inside it.
Overview
Spotlight adds a quiet glow under the pointer as it moves across a container. Cards inside it, rendered with SpotlightCard, light up along the part of their border nearest the pointer, even before the pointer reaches them, so a grid of cards reads as one lit surface. It suits feature grids, pricing tiers, and dashboards where a little depth helps without moving anything.
The surface glow follows the pointer with a light spring. Card borders update once per frame from a single listener on the container, so a large grid does not attach a handler to every card. Set glow={false} to light only the card borders.
Installation
Usage
import { Spotlight, SpotlightCard } from "@/components/animated/spotlight"
<Spotlight className="grid grid-cols-2 gap-3">
<SpotlightCard className="p-4">Edge functions</SpotlightCard>
<SpotlightCard className="p-4">Managed storage</SpotlightCard>
</Spotlight>Colors accept any CSS color, including color-mix() and variables. The defaults are tints of --foreground, so the light works in both themes.
Accessibility
The light is decorative and hidden from assistive technology; the cards and their content are unchanged. It responds only to a mouse or trackpad: on touch devices and when the user prefers reduced motion, the cards render as plain bordered cards. Do not rely on the light to show focus or selection; style those states on the cards themselves.