Spotlight Cards

A grid of link cards where one soft light follows the mouse across the whole grid and catches the borders nearby.

Examples

Primary tint

The light uses the primary colour. Move the mouse between two cards: both edges catch it.

Neutral tint

The same light in the foreground colour, for settings and quieter pages.

Installation

npx shadcn@latest add https://ui.ndekocode.dev/r/motion-spotlight-cards.json

Component API

SpotlightCards

The grid that tracks the mouse. Renders a <div> with grid gap-3; set the columns with className.

PropTypeDefaultDescription
tint'primary' | 'neutral''primary'The colour of the light.
classNamestringClasses for the grid.
childrenReact.ReactNodeThe SpotlightCard items.

SpotlightCard

A card that is a link. Renders an <a>: href and every other anchor attribute pass through. Its children stack in a column.

PropTypeDefaultDescription
classNamestringClasses for the card.
childrenReact.ReactNodeThe card content.

Accessibility and motion

  • The light follows a mouse only. Touch and pen leave the cards as they are.
  • The light trails the pointer on a spring with no bounce. With reduced motion it sits exactly under the pointer, and it fades in and out the same way.
  • The light layers are decorative and hidden from assistive technology.

Credits

Inspired by the spotlight cards of UI Layouts, rebuilt on our tokens and motion.