Overview
ImageExpandTestimonial displays a set of testimonials with a portrait gallery where the active reviewer’s photo expands to full height while inactive photos collapse to thumbnails. On desktop, the active photo is anchored to the right; on mobile it is centered. Transitions are driven by Framer Motion spring physics.
Installation
Requires
framer-motion, lucide-react, and next/image (Next.js). Install peer dependencies:Usage
Props
Array of testimonial objects. Each object must have the following shape:
Interval in milliseconds between automatic testimonial advances. The timer resets when the user manually navigates.
Additional CSS classes applied to the outermost container. The container defaults to
max-w-7xl mx-auto.Examples
Faster autoplay
Disabled autoplay (set a very large interval)
Full-height section
Features
Expanding Photo Gallery
The active portrait animates from a small thumbnail to a tall hero image using Framer Motion layout animations with spring physics.
Responsive Layout
On mobile (<1024px) the active photo is centered; on desktop it’s anchored to the right, with a sidebar index counter.
Half-Star Ratings
Star ratings support decimal values (e.g.
4.5) with a pixel-perfect half-star clip mask implementation.Auto-Play with Reset
Auto-advance timer resets on manual navigation, preventing jarring transitions right after user interaction.