Hover Image List
A list of large headings that reveal an image on the left and shift right on hover, animated with Motion.
Installation
File Structure
hover-image-list.tsx
Usage
import { HoverImageList } from "@/components/unlumen-ui/hover-image-list";
const items = [
{ label: "Design systems", image: "/images/design.jpg" },
{ label: "Prototyping", image: "/images/proto.jpg" },
{ label: "Motion & animation", image: "/images/motion.jpg" },
];
<HoverImageList items={items} />;API Reference
HoverImageList
| Prop | Type | Default |
|---|---|---|
items | HoverImageListItem[] | - |
imageWidth? | number | 220 |
imageGap? | number | 40 |
className? | string | - |
HoverImageListItem
| Prop | Type | Default |
|---|---|---|
label | string | - |
image | string | - |
imageAlt? | string | "" |
Notes
- The image panel tracks the hovered item's vertical center using a Motion spring (
stiffness: 200,damping: 18,mass: 0.6) — the image slides smoothly between items. - Images are
aspect-squareandobject-coverby default. Provide square or close-to-square images for the best result. - The hovered item shifts 16px to the right, non-hovered items fade to
opacity: 0.18— both animated with a stiff spring (stiffness: 380,damping: 30). - Image transitions use
AnimatePresencewithmode="popLayout"— the outgoing image fades out while the incoming one fades in, with no layout jump. - Images use
loading="lazy"anddecoding="async"— but since they appear on hover, consider preloading critical images if the list is short. - The component uses
onHoverStart/onHoverEndfrom Motion — these fire on pointer enter/leave, not on focus. For keyboard accessibility, you may want to addonFocushandlers. - Set
imageWidthandimageGapto control the layout. The image panel isflex-shrink-0so it never collapses.
Credits
Inspired by @raul_dronca's original Design. Thanks to Raul for the initial idea!