Hover Cards

Link cards that answer the pointer with one of four treatments, and only where a pointer can hover.

Examples

Zoom

The image grows inside its frame while the card keeps its size.

Rise

The details rise over the image on hover or keyboard focus. On touch screens they stay visible.

Tilt

The card leans toward the mouse on a spring and its edge catches the light where the pointer is.

Trace

A border draws itself around the card, and leaves faster than it came.

Installation

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

Component API

HoverEffectCard

Renders an <a>: every other anchor attribute (href, target, rel) passes through.

PropTypeDefaultDescription
effect'zoom' | 'rise' | 'tilt' | 'trace'The hover treatment.
titleReact.ReactNodeThe card title.
descriptionReact.ReactNodeA short line under the title.
metaReact.ReactNodeA small row of details. With rise, it is the panel that rises in.
image{ src: string; alt: string }The card image.
classNamestringClasses for the link.

Accessibility and motion

  • Every card is a link with a visible focus outline. Keyboard focus also brings up the rising details and the traced border.
  • Hover effects run only on devices that can hover. The tilt follows a mouse, never a finger.
  • With reduced motion, the zoom and the tilt are off, the rising details only fade and the border appears without drawing.

Credits

The effects are inspired by the hover cards of UI Layouts, rebuilt on our tokens and motion.