Image Reveal

A list of titles where the hovered row shows its picture beside the pointer.

Examples

Portfolio

One frame follows the pointer and changes its picture in place when the pointer reaches another row. It sits beside the pointer, so the title under it stays readable, and moves to the other side near the right edge.

Compact list

rowClassName, titleClassName and imageClassName size the rows, the titles and the frame. Press Tab to reach a row: the picture appears fixed at its end, without moving.

Installation

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

Component API

ImageReveal

PropTypeDefaultDescription
itemsImageRevealItem[]The rows.
onSelect(item: ImageRevealItem) => voidCalled when a row without href is pressed.
rowClassNamestringClasses of each row.
titleClassNamestringClasses of each title, text-2xl font-semibold sm:text-3xl by default.
imageClassNamestringClasses of the frame, aspect-[3/2] w-60 by default.
classNamestringClasses of the wrapper.

ImageRevealItem

FieldTypeDescription
idstringA unique id.
titlestringThe row title.
metaReactNodeA short value at the end of the row.
srcstringThe picture shown on hover or focus.
hrefstringTurns the row into a link, otherwise a button.

The frame is decorative and hidden from assistive technology: the row title carries the meaning. It never shows on touch screens. Under reduced motion it jumps to the pointer instead of following it with a spring.