React Alice Carousel is a feature-rich React component designed for creating various content galleries, slideshows, and rotators. As of version 2.9.1, it offers extensive customization, including auto height/width, autoplay with various strategies, custom animation types (slide, fadeout), infinite looping, lazy loading, and full mobile and touch/drag support. It is also server-side rendering (SSR) friendly and ships with TypeScript definitions, making it suitable for modern web applications. The library is actively maintained, with a clear distinction between its v1 and v2 APIs, indicating a commitment to evolving its feature set and internal architecture over time. The project maintains a steady release cadence for bug fixes and minor features.
npm install react-alice-carouselVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of React Alice Carousel with `mouseTracking`, `infinite` loop, `autoPlay`, responsive items, and custom controls strategy, using placeholder images.
Refer to the v2 API documentation (https://maxmarinich.github.io/react-alice-carousel/) for current prop definitions and usage patterns when upgrading.
Add `import 'react-alice-carousel/lib/alice-carousel.css';` to your root component or the file where you use the carousel. Ensure your build system (e.g., Webpack, Vite) is configured to process CSS imports.
Always provide an array of React elements to the `items` prop. For images, ensure they have `onDragStart={e => e.preventDefault()}` and `role="presentation"` for proper behavior and accessibility.Carefully review the documentation for `autoPlayStrategy` to select the value that aligns with your desired user interaction and autoplay behavior.
Add `import 'react-alice-carousel/lib/alice-carousel.css';` to the top of your component file or an entry point file (e.g., `App.js`, `main.tsx`).
Ensure the `items` prop is always an array of React elements, e.g., `items={[<div key="1">Slide 1</div>]}`. Do not pass `null` or `undefined`.Double-check that `import 'react-alice-carousel/lib/alice-carousel.css';` is present and correctly resolved by your build system. Inspect browser developer tools to see if the carousel's CSS rules are present and applied.