Spotlight Card
Card with cursor-tracked radial spotlight effect on hover.
Installation$
Package Manager$
pnpm add @glinui/ui @glinui/tokensRegistry$
pnpm dlx @glinui/cli@latest add spotlight-cardUsage$
SpotlightCard wraps GlassCard and tracks the cursor position via CSS custom properties --spot-x and --spot-y to project a radial spotlight onto the card surface. Move your pointer over the card below to see the effect.
Spotlight Card
Hover to reveal the cursor-tracked spotlight effect.
1import { SpotlightCard } from "@glinui/ui"23export function SpotlightCardBasicDemo() {4return (5 <div className="flex items-center justify-center min-h-[240px] bg-gradient-to-br from-neutral-950 to-neutral-900 rounded-xl p-8">6 <SpotlightCard className="w-72">7 <p className="text-sm font-semibold text-foreground">Spotlight Card</p>8 <p className="mt-1 text-sm text-neutral-500 dark:text-neutral-400">9 Hover to reveal the cursor-tracked spotlight effect.10 </p>11 </SpotlightCard>12 </div>13)14}
Examples$
Custom Spotlight Color$
Pass spotlightClassName to override the radial gradient used for the spotlight. The overlay is a radial-gradient positioned at --spot-x / --spot-y, so swapping the color stop is the only change needed.
Default
White radial light
Indigo
Accent-colored light
Amber
Warm golden light
1import { SpotlightCard } from "@glinui/ui"23export function SpotlightCardColorDemo() {4return (5 <div className="flex flex-wrap items-center justify-center gap-4 bg-gradient-to-br from-neutral-950 to-neutral-900 rounded-xl p-8">6 {/* Default — white light */}7 <SpotlightCard className="w-52">8 <p className="text-xs font-semibold text-neutral-400 uppercase tracking-widest">Default</p>9 <p className="mt-2 text-sm text-neutral-300">White radial light</p>10 </SpotlightCard>1112 {/* Indigo accent */}13 <SpotlightCard14 className="w-52"15 spotlightClassName="[background:radial-gradient(220px_circle_at_var(--spot-x,_50%)_var(--spot-y,_50%),rgb(99_102_241_/_0.35),transparent_70%)]"16 >17 <p className="text-xs font-semibold text-neutral-400 uppercase tracking-widest">Indigo</p>18 <p className="mt-2 text-sm text-neutral-300">Accent-colored light</p>19 </SpotlightCard>2021 {/* Amber warmth */}22 <SpotlightCard23 className="w-52"24 spotlightClassName="[background:radial-gradient(220px_circle_at_var(--spot-x,_50%)_var(--spot-y,_50%),rgb(251_191_36_/_0.3),transparent_70%)]"25 >26 <p className="text-xs font-semibold text-neutral-400 uppercase tracking-widest">Amber</p>27 <p className="mt-2 text-sm text-neutral-300">Warm golden light</p>28 </SpotlightCard>29 </div>30)31}
Sizes$
SpotlightCard inherits the size prop from GlassCard — sm, md, or lg — which controls internal padding.
Small — p-4
Compact padding for dense layouts
Medium — p-6
Default comfortable padding
Large — p-8
Generous padding for hero cards
1import { SpotlightCard } from "@glinui/ui"23export function SpotlightCardSizeDemo() {4return (5 <div className="flex flex-col gap-4 bg-gradient-to-br from-neutral-950 to-neutral-900 rounded-xl p-8">6 <SpotlightCard size="sm" className="w-full">7 <p className="text-sm font-semibold text-foreground">Small — p-4</p>8 <p className="text-xs text-neutral-500 mt-1">Compact padding for dense layouts</p>9 </SpotlightCard>10 <SpotlightCard size="md" className="w-full">11 <p className="text-sm font-semibold text-foreground">Medium — p-6</p>12 <p className="text-xs text-neutral-500 mt-1">Default comfortable padding</p>13 </SpotlightCard>14 <SpotlightCard size="lg" className="w-full">15 <p className="text-sm font-semibold text-foreground">Large — p-8</p>16 <p className="text-xs text-neutral-500 mt-1">Generous padding for hero cards</p>17 </SpotlightCard>18 </div>19)20}
Feature Grid$
A common landing-page pattern: a grid of SpotlightCard components on a dark backdrop creates interactive feature sections with zero animation boilerplate.
Fast by Default
Zero-config tree-shaking and code splitting out of the box.
Type-Safe API
Every prop is typed end-to-end with TypeScript generics.
Composable
Radix primitives at the core — extend without fighting the API.
1import { SpotlightCard } from "@glinui/ui"23const features = [4{ title: "Fast by Default", body: "Zero-config tree-shaking and code splitting out of the box." },5{ title: "Type-Safe API", body: "Every prop is typed end-to-end with TypeScript generics." },6{ title: "Composable", body: "Radix primitives at the core — extend without fighting the API." },7]89export function SpotlightFeatureGridDemo() {10return (11 <div className="grid grid-cols-1 sm:grid-cols-3 gap-4 bg-gradient-to-br from-neutral-950 to-neutral-900 rounded-xl p-8">12 {features.map((f) => (13 <SpotlightCard key={f.title} size="sm">14 <p className="text-sm font-semibold text-foreground">{f.title}</p>15 <p className="mt-1 text-xs text-neutral-500 leading-relaxed">{f.body}</p>16 </SpotlightCard>17 ))}18 </div>19)20}
Accessibility$
- The spotlight overlay carries
aria-hidden="true"andpointer-events-noneso it is invisible to assistive technology and cannot intercept interactions. - All content inside the card remains fully keyboard-accessible and semantically structured.
SpotlightCarddoes not modify focus behavior — interactive children (buttons, links) work as expected.
Reduced Motion$
The spotlight overlay is hidden entirely when prefers-reduced-motion: reduce is set via motion-reduce:hidden. The underlying GlassCard hover transition (transform, box-shadow) is also disabled via motion-reduce:transition-none and motion-reduce:hover:translate-y-0, ensuring zero motion for users who prefer it.
API Reference$
SpotlightCard$
Accepts all props from GlassCard (which in turn accepts all div HTML attributes). The only additional prop is spotlightClassName.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
spotlightClassName | string | No | - | Auto-generated from TypeScript source. |
Source$
1import { SpotlightCard } from "@glinui/ui"
Generated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/spotlight-card.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-02-19T17:59:28.468Z · Full index: /docs/api-metadata
Primary Props Type
SpotlightCardProps
SpotlightCardProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
spotlightClassName | string | No | - | - |