Spotlight card
A card whose surface and border light up around the pointer, for a grid of features or plans that invites a closer look. Inside it is the card: build it from the same parts. For a light that runs round the border on its own, use the border beam.
Install
npx shadcn@latest add @thrum-pro/spotlight-cardThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | number | Default 240 | The radius of the glow around the pointer, in pixels. Anything under 16 is drawn as 16. |
ambient | boolean | Default true | Show a subtle resting upper-left spotlight sheen before pointer hover or keyboard focus. |
children | ReactNode | – | The card's parts: CardHeader, CardTitle, CardDescription, CardAction, CardContent and CardFooter from the card. |
className | string | – | Extra classes, merged last. Set the width here. |
...props | ComponentProps<"div"> | – | Every other div attribute and event handler is passed through to the card. An onPointerMove of yours runs before the glow moves. |
Motion and sound
Motion
- While the pointer is over the card, a soft glow of the primary colour at 18% follows it across the surface, and the border near it takes the primary colour at 85%. Both fade in and out over 200 ms, replacing the resting ambient sheen.
- The pointer's position is written into two CSS variables on the card by one pointermove listener. React does not re-render as the pointer moves.
- Touch: nothing. A touch screen never sees the glow.
- Keyboard focus inside the card lights it, from the middle of its top edge or from where the pointer last was, and the light stays still.
- Reduced motion: the glow does not follow the pointer and does not appear on hover. Focus inside the card still lights it from the top.
Sound
Silent. This component makes no sound.
Accessibility
- It is the card: a plain div with no role. Name it the way the card says, with a heading in CardTitle or with role="region" and an aria-label.
- Both glow layers sit under the content and are hidden from screen readers. The surface glow is the primary colour at 18%, so text keeps its contrast at every pointer position.
- Under a glass material the card turns translucent like any card, and the glow is drawn on that surface.
| Keys | Action |
|---|---|
| Tab | Moves to the controls inside the card. While one has focus, the card is lit. |
Source
The source comes with Pro
TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies
Files and dependencies
- Adds
components/ui/spotlight-card.tsx- Packages
motion- Brings along
- CardMotion tokens
Changelog
- 1.0.0 · 2026-12-03First release.