Loading preview
Glow Grid
CardsCards whose borders light up near the pointer, as if a light moved across them.
A card with a soft light that follows the pointer.
npx shadcn@latest add @venusui/spotlight-cardRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/hooks/use-pointer-position.tsfrom use-pointer-position@/lib/compose-refs.tsfrom compose-refs@/components/ui/spotlight-card.tsxThe code behind the preview above.
spotlight-card-demo.tsx
import { SpotlightCard } from "@/components/ui/spotlight-card"
export default function SpotlightCardDemo() {
return (
<SpotlightCard className="w-full max-w-sm p-6">
<p className="text-sm font-medium text-muted-foreground">Usage this month</p>
<p className="mt-2 text-3xl font-semibold tracking-tight">12,480</p>
<p className="mt-1 text-sm text-muted-foreground">Move your pointer across the card.</p>
</SpotlightCard>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| spotlightColor | string | foreground at 10% | Color of the light. Any CSS color, e.g. rgb(59 130 246 / 0.25). |
| radius | number | 320 | Radius of the light, in pixels. |
All <div> props, including className, style, children and ref.
ref as a prop and uses a ref cleanup function.cn helper at @/lib/utils, which npx shadcn@latest init creates.className. Classes are merged with cn, so className="rounded-2xl p-8" replaces the default radius and padding.--spotlight-color and --spotlight-radius (set from the props), and --pointer-x / --pointer-y (written by usePointerPosition).usePointerPosition works on its own: attach the ref it returns to any element to get --pointer-x, --pointer-y and --pointer-active for your own effects.aria-hidden and hidden when the user prefers reduced motion.spotlightColor.ref.ref is a regular prop. Upgrade React, or remove the ref handling.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.Cards whose borders light up near the pointer, as if a light moved across them.
A card that tilts in 3D toward the pointer with spring physics.
A flight boarding pass with a perforated stub and code that flips to the fare and baggage details.