⚠️ Beta Version - This package is currently in beta. API may change in future releases.
A beautiful React component for displaying images in a stacked carousel with smooth slide animations. Features a unique stacked effect where images appear layered behind each other, creating an elegant visual experience.
- 🎨 Beautiful Stacked Effect - Displays 3 images at once with a layered appearance
- 🎬 Smooth Animations - Images slide smoothly to the right when transitioning
- ⚙️ Highly Customizable - Control sizes, timing, styling, and behavior
- 📱 Responsive - Works well on all screen sizes
- ♿ Accessible - Proper alt text support for screen readers
- 🎯 TypeScript Support - Full TypeScript definitions included
- 📦 Zero Dependencies - Only requires React (no external dependencies)
- 🎨 CSS-in-JS Ready - Import styles separately or customize with your own
npm install react-image-stack-carouselor
yarn add react-image-stack-carouselor
pnpm add react-image-stack-carouselimport { ImageStackCarousel } from 'react-image-stack-carousel';
import 'react-image-stack-carousel/dist/index.css';
const images = [
'https://example.com/image1.jpg',
'https://example.com/image2.jpg',
'https://example.com/image3.jpg',
];
function App() {
return (
<ImageStackCarousel
images={images}
autoPlay={true}
interval={4000}
/>
);
}| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
images |
string[] |
- | ✅ | Array of image URLs to display |
autoPlay |
boolean |
true |
❌ | Enable automatic image rotation |
interval |
number |
4000 |
❌ | Time between transitions in milliseconds |
width |
number |
455 |
❌ | Width of the front image in pixels |
height |
number |
550 |
❌ | Height of the front image in pixels |
borderRadius |
number |
8 |
❌ | Border radius for images in pixels |
onImageChange |
(index: number) => void |
- | ❌ | Callback function called when image changes |
showIndicators |
boolean |
false |
❌ | Show indicator dots below the carousel |
className |
string |
'' |
❌ | Custom class name for the container |
altTextPrefix |
string |
'Image' |
❌ | Prefix for image alt text (e.g., "Image 1", "Image 2") |
import { ImageStackCarousel } from 'react-image-stack-carousel';
import 'react-image-stack-carousel/dist/index.css';
function App() {
const images = [
'/path/to/image1.jpg',
'/path/to/image2.jpg',
'/path/to/image3.jpg',
];
return <ImageStackCarousel images={images} />;
}<ImageStackCarousel
images={images}
width={600}
height={800}
borderRadius={16}
/><ImageStackCarousel
images={images}
showIndicators={true}
/><ImageStackCarousel
images={images}
autoPlay={false}
onImageChange={(index) => {
console.log('Current image index:', index);
}}
/><ImageStackCarousel
images={images}
className="my-custom-carousel"
/><ImageStackCarousel
images={images}
altTextPrefix="Product"
// Results in: "Product 1", "Product 2", etc.
/>The component displays up to 3 images simultaneously in a stacked arrangement:
- Front Image: Full size (100%), fully visible and active
- Back Image 1: 90% scale, partially visible on the left side
- Back Image 2: 80% scale, further left, behind back-1
When transitioning to the next image:
- The current front image slides to the right and fades out
- Back-1 smoothly moves forward to become the new front image
- Back-2 moves to the back-1 position
- The next image in the array appears as the new back-2
- The cycle continues seamlessly
# Clone the repository
git clone <repository-url>
# Install dependencies
npm install
# Run development server (with example)
npm run dev
# Build for production
npm run build- React >= 16.8.0 (hooks support required)
- React DOM >= 16.8.0
This is a beta version. Feedback and contributions are welcome! Please feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
MIT © [Your Name]
- Touch/swipe gesture support
- Keyboard navigation
- Custom transition animations
- Lazy loading support
- More customization options
Note: This is a beta release. The API is stable but may receive minor updates based on feedback. For production use, please test thoroughly in your environment.