
Image Carousel
- 7 installs
- 6 repo stars
- Updated February 8, 2026
- ainergiz/design-inspirations
image-carousel is a Claude Code skill that builds image carousels with hover-activated auto-advance, touch swipe support, and animated progress indicators.
About
image-carousel is a Claude Code skill that builds React image carousels that auto-advance on hover, support touch swipe on mobile, and show animated progress indicators. Manual navigation temporarily pauses the auto-advance. A developer uses it when building image galleries, product showcases, or multi-image displays.
- Auto-advance triggers on hover rather than on page load
- Touch swipe navigation with a 50px threshold and pause-on-interaction
- Glassmorphic progress-pill indicators with animated fill
Image Carousel by the numbers
- 7 all-time installs (skills.sh)
- Ranked #1,756 of 2,244 Frontend Development skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
image-carousel capabilities & compatibility
- Capabilities
- image carousel · touch swipe · auto advance
- Use cases
- frontend · ui design
- Pricing
- Free
What image-carousel says it does
Creates image carousels with hover-activated auto-advance, touch swipe support, and animated progress indicators.
Auto-advance starts only when user hovers (not on page load)
npx skills add https://github.com/ainergiz/design-inspirations --skill image-carouselAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 7 |
|---|---|
| repo stars | ★ 6 |
| Last updated | February 8, 2026 |
| Repository | ainergiz/design-inspirations ↗ |
What it does
Building React image carousels with hover auto-advance, touch swipe, and animated progress indicators.
Who is it for?
Image galleries and product showcases needing hover auto-advance and mobile swipe.
Skip if: Infinite virtualized feeds or video playlist players.
When should I use this skill?
When building image galleries, product showcases, or any multi-image display with navigation.
What you get
A carousel that advances on hover, swipes on touch, and shows animated progress.
- ImageCarousel component with hover auto-advance and touch swipe
By the numbers
- 50px swipe threshold
- 3000ms auto-advance interval
Files
Image Carousel Pattern
Build smooth image carousels that auto-advance on hover with touch swipe support and animated progress indicators.
Core Features
- Hover-activated: Auto-advance starts only when user hovers (not on page load)
- Touch swipe: Mobile-friendly swipe navigation with threshold detection
- Progress indicators: Glassmorphic pill indicators with animated fill
- Pause on interaction: Manual navigation pauses auto-advance temporarily
State Management
const [currentIndex, setCurrentIndex] = useState(0);
const [isHovered, setIsHovered] = useState(false);
const [progressKey, setProgressKey] = useState(0); // Forces animation restart
const [isPaused, setIsPaused] = useState(false);
const [touchStart, setTouchStart] = useState<number | null>(null);Core Implementation
"use client";
import { useState, useEffect } from "react";
import Image from "next/image";
const images = [
"/images/image-1.jpeg",
"/images/image-2.jpeg",
"/images/image-3.jpeg",
];
function ImageCarousel() {
const [currentIndex, setCurrentIndex] = useState(0);
const [isHovered, setIsHovered] = useState(false);
const [progressKey, setProgressKey] = useState(0);
const [isPaused, setIsPaused] = useState(false);
const [touchStart, setTouchStart] = useState<number | null>(null);
// Auto-advance effect - only when hovered and not paused
useEffect(() => {
if (!isHovered || isPaused) return;
const interval = setInterval(() => {
setCurrentIndex((prev) => (prev + 1) % images.length);
setProgressKey((prev) => prev + 1);
}, 3000);
return () => clearInterval(interval);
}, [isHovered, isPaused]);
// Touch handlers
const handleTouchStart = (e: React.TouchEvent) => {
setTouchStart(e.touches[0].clientX);
};
const handleTouchEnd = (e: React.TouchEvent) => {
if (touchStart === null) return;
const touchEnd = e.changedTouches[0].clientX;
const diff = touchStart - touchEnd;
const threshold = 50;
if (Math.abs(diff) > threshold) {
if (diff > 0) {
// Swipe left - next image
setCurrentIndex((prev) => (prev + 1) % images.length);
} else {
// Swipe right - previous image
setCurrentIndex((prev) => (prev - 1 + images.length) % images.length);
}
setProgressKey((prev) => prev + 1);
setIsPaused(true);
setTimeout(() => setIsPaused(false), 3000);
}
setTouchStart(null);
};
return (
<div
className="relative h-full w-full group touch-pan-y"
onMouseEnter={() => {
setIsHovered(true);
setProgressKey((prev) => prev + 1);
}}
onMouseLeave={() => setIsHovered(false)}
onTouchStart={handleTouchStart}
onTouchEnd={handleTouchEnd}
>
{/* Images with fade transition */}
{images.map((src, index) => (
<Image
key={src}
src={src}
alt={`Image ${index + 1}`}
fill
className={`object-cover transition-opacity duration-700 ease-in-out ${
index === currentIndex ? "opacity-100" : "opacity-0"
}`}
/>
))}
{/* Glassmorphic indicator container */}
<div className="absolute bottom-3 left-1/2 -translate-x-1/2">
<div className="flex items-center gap-2 px-3 py-2 rounded-full bg-black/20 backdrop-blur-md border border-white/10">
{images.map((_, index) => (
<button
key={index}
onClick={() => {
setCurrentIndex(index);
setIsPaused(true);
setProgressKey((prev) => prev + 1);
setTimeout(() => setIsPaused(false), 3000);
}}
className="relative cursor-pointer"
>
{/* Background pill */}
<div
className={`h-2 rounded-full transition-all duration-300 ${
index === currentIndex
? "w-6 bg-white"
: "w-2 bg-white/40 hover:bg-white/60"
}`}
/>
{/* Animated progress fill - only when hovered and not paused */}
{index === currentIndex && isHovered && !isPaused && (
<div
key={progressKey}
className="absolute inset-0 h-2 rounded-full bg-white/50 origin-left animate-carousel-progress"
style={{ animationDuration: "3000ms" }}
/>
)}
</button>
))}
</div>
</div>
</div>
);
}Required CSS (add to globals.css)
/* Carousel progress animation */
@keyframes carousel-progress {
from {
transform: scaleX(0);
}
to {
transform: scaleX(1);
}
}
.animate-carousel-progress {
animation: carousel-progress linear forwards;
}Key Behaviors
Auto-Advance Logic
| State | Behavior |
|---|---|
| Not hovered | No auto-advance |
| Hovered + not paused | Auto-advance every 3s |
| Hovered + paused | No auto-advance (resumes after 3s) |
Touch Swipe
- Threshold: 50px minimum swipe distance
- Left swipe: Next image
- Right swipe: Previous image
- After swipe: Pause auto-advance for 3s
Progress Indicator
- Expands from dot (w-2) to pill (w-6) when active
- Shows animated fill overlay only when hovering and not paused
progressKeyforces animation restart on index change
Indicator Sizing
| Context | Active Width | Inactive Width | Height |
|---|---|---|---|
| Preview (compact) | w-4 | w-1.5 | h-1.5 |
| Detail page | w-6 | w-2 | h-2 |
Timing Configuration
| Duration | Use |
|---|---|
3000ms | Auto-advance interval |
3000ms | Pause duration after manual interaction |
700ms | Image fade transition |
300ms | Indicator pill expansion |
Checklist
- [ ]
touch-pan-yon container for proper scroll behavior - [ ] Images use
fillprop withobject-cover - [ ]
progressKeystate for animation restart - [ ] Pause timeout clears and resumes correctly
- [ ]
animate-carousel-progresskeyframes added to globals.css
Related skills
FAQ
When does the carousel auto-advance?
Only when the user hovers and it is not paused, not on page load.
Does it support mobile?
Yes, it has touch swipe navigation with a 50px threshold.