Top Related Projects
Most modern mobile touch slider with hardware accelerated transitions
the last carousel you'll ever need
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
A lightweight carousel library with fluid motion and great swipe precision.
Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
Quick Overview
React-slick is a responsive carousel component built for React applications. It's a port of the popular jQuery plugin "slick carousel" and provides a customizable and feature-rich slider solution for React developers.
Pros
- Easy integration with React projects
- Highly customizable with numerous options and settings
- Responsive design that works well on various screen sizes
- Supports both horizontal and vertical sliding
Cons
- Can be performance-intensive with a large number of slides
- Some users report issues with TypeScript definitions
- Documentation could be more comprehensive
- Occasional conflicts with other libraries or CSS frameworks
Code Examples
Basic usage:
import React from 'react';
import Slider from 'react-slick';
const SimpleSlider = () => {
const settings = {
dots: true,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1
};
return (
<Slider {...settings}>
<div><h3>1</h3></div>
<div><h3>2</h3></div>
<div><h3>3</h3></div>
</Slider>
);
};
Custom arrows:
import React from 'react';
import Slider from 'react-slick';
const CustomArrowSlider = () => {
const NextArrow = (props) => {
const { className, style, onClick } = props;
return (
<div
className={className}
style={{ ...style, display: "block", background: "red" }}
onClick={onClick}
/>
);
};
const settings = {
nextArrow: <NextArrow />,
prevArrow: <PrevArrow />
};
return (
<Slider {...settings}>
{/* Slide content */}
</Slider>
);
};
Responsive settings:
const ResponsiveSlider = () => {
const settings = {
dots: true,
infinite: false,
speed: 500,
slidesToShow: 4,
slidesToScroll: 4,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
dots: true
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
initialSlide: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
};
return (
<Slider {...settings}>
{/* Slide content */}
</Slider>
);
};
Getting Started
-
Install the package:
npm install react-slick slick-carousel
-
Import CSS files in your React app:
import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css";
-
Use the Slider component in your React application:
import React from 'react'; import Slider from 'react-slick'; const MySlider = () => { const settings = { dots: true, infinite: true, speed: 500, slidesToShow: 1, slidesToScroll: 1 }; return ( <Slider {...settings}> <div><h3>Slide 1</h3></div> <div><h3>Slide 2</h3></div> <div><h3>Slide 3</h3></div> </Slider> ); }; export default MySlider;
Competitor Comparisons
Most modern mobile touch slider with hardware accelerated transitions
Pros of Swiper
- More versatile, supporting various frameworks beyond React
- Extensive features including 3D effects, parallax, and virtual slides
- Active development with frequent updates and improvements
Cons of Swiper
- Larger bundle size due to its comprehensive feature set
- Steeper learning curve for basic implementations
- May require additional setup for React projects
Code Comparison
React-Slick:
import Slider from "react-slick";
<Slider dots={true} infinite={true} speed={500} slidesToShow={3}>
<div><h3>1</h3></div>
<div><h3>2</h3></div>
<div><h3>3</h3></div>
</Slider>
Swiper:
import { Swiper, SwiperSlide } from 'swiper/react';
<Swiper slidesPerView={3} spaceBetween={30}>
<SwiperSlide>Slide 1</SwiperSlide>
<SwiperSlide>Slide 2</SwiperSlide>
<SwiperSlide>Slide 3</SwiperSlide>
</Swiper>
Summary
While React-Slick offers a simpler, React-specific solution, Swiper provides a more feature-rich and versatile option for creating sliders and carousels. React-Slick may be preferable for straightforward React projects, while Swiper shines in complex, multi-platform applications requiring advanced functionality.
the last carousel you'll ever need
Pros of Slick
- More mature and widely adopted, with a larger community and ecosystem
- Supports a broader range of browsers and devices
- Offers more customization options and advanced features out of the box
Cons of Slick
- Requires jQuery as a dependency, which may not be ideal for modern React projects
- Less integrated with React's component-based architecture
- May have a steeper learning curve for React developers
Code Comparison
Slick (jQuery-based):
$('.slider').slick({
dots: true,
infinite: true,
speed: 500,
slidesToShow: 3,
slidesToScroll: 1
});
React-Slick (React-based):
import Slider from "react-slick";
<Slider
dots={true}
infinite={true}
speed={500}
slidesToShow={3}
slidesToScroll={1}
>
{/* Slide content */}
</Slider>
Summary
Slick is a more established and feature-rich carousel library, but it relies on jQuery. React-Slick, on the other hand, is specifically designed for React applications, offering better integration with React's component model and state management. While Slick may offer more flexibility and browser support, React-Slick provides a more React-friendly API and doesn't require jQuery, making it a potentially better choice for modern React projects.
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
Pros of Glide
- Framework-agnostic, works with any JavaScript project
- Smaller bundle size (around 34KB vs 54KB for React Slick)
- More customizable with a modular plugin system
Cons of Glide
- Less React-specific features and integration
- Fewer pre-built components and themes
- May require more manual setup for React projects
Code Comparison
React Slick:
import Slider from "react-slick";
<Slider dots={true} infinite={true} speed={500} slidesToShow={3}>
<div><img src="image1.jpg" alt="Slide 1" /></div>
<div><img src="image2.jpg" alt="Slide 2" /></div>
<div><img src="image3.jpg" alt="Slide 3" /></div>
</Slider>
Glide:
<div class="glide">
<div class="glide__track" data-glide-el="track">
<ul class="glide__slides">
<li class="glide__slide"><img src="image1.jpg" alt="Slide 1" /></li>
<li class="glide__slide"><img src="image2.jpg" alt="Slide 2" /></li>
<li class="glide__slide"><img src="image3.jpg" alt="Slide 3" /></li>
</ul>
</div>
</div>
<script>
new Glide('.glide').mount()
</script>
Both React Slick and Glide are popular carousel/slider libraries, but they cater to different use cases. React Slick is specifically designed for React applications, offering seamless integration and React-specific features. Glide, on the other hand, is more versatile and can be used in various JavaScript projects, including React with some additional setup.
Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
Pros of Splide
- Lightweight and fast, with no dependencies
- Supports touch swipe and mouse drag out of the box
- More customizable with extensive options and API
Cons of Splide
- Requires more setup for React integration
- Less React-specific documentation and examples
- Steeper learning curve for React developers
Code Comparison
Splide (vanilla JavaScript):
new Splide('.splide', {
type: 'loop',
perPage: 3,
autoplay: true,
}).mount();
react-slick (React component):
<Slider
dots={true}
infinite={true}
speed={500}
slidesToShow={3}
slidesToScroll={1}
>
{slides.map((slide) => (
<div key={slide.id}>{slide.content}</div>
))}
</Slider>
Summary
Splide is a versatile and lightweight slider library that works well across different frameworks, including React. It offers more customization options and better performance but requires additional setup for React integration.
react-slick, on the other hand, is specifically designed for React applications, making it easier to implement for React developers. It provides a more straightforward API and better documentation for React use cases but may have limitations in terms of customization and performance compared to Splide.
The choice between the two depends on the specific project requirements, the developer's familiarity with React, and the need for customization and performance optimization.
A lightweight carousel library with fluid motion and great swipe precision.
Pros of Embla Carousel
- Framework-agnostic, offering more flexibility across different projects
- Smaller bundle size, potentially improving performance
- More customizable with plugins and API options
Cons of Embla Carousel
- Less out-of-the-box features compared to React Slick
- Steeper learning curve for advanced customizations
- Fewer pre-built themes and styles
Code Comparison
React Slick:
import Slider from "react-slick";
<Slider dots={true} infinite={true} speed={500} slidesToShow={3}>
<div><h3>1</h3></div>
<div><h3>2</h3></div>
<div><h3>3</h3></div>
</Slider>
Embla Carousel:
import useEmblaCarousel from 'embla-carousel-react'
const [emblaRef] = useEmblaCarousel({ loop: false })
<div className="embla" ref={emblaRef}>
<div className="embla__container">
<div className="embla__slide"><h3>1</h3></div>
<div className="embla__slide"><h3>2</h3></div>
<div className="embla__slide"><h3>3</h3></div>
</div>
</div>
Both carousels offer smooth sliding functionality, but Embla Carousel requires more manual setup for basic features like dots and infinite loop. React Slick provides these options as simple props, making it easier to implement common carousel patterns quickly.
Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
Pros of nuka-carousel
- More customizable and flexible, allowing for greater control over carousel behavior
- Better touch and swipe support, especially on mobile devices
- Smoother animations and transitions between slides
Cons of nuka-carousel
- Slightly larger bundle size, which may impact performance on slower connections
- Less extensive documentation compared to react-slick
- Fewer built-in features, requiring more manual configuration
Code Comparison
nuka-carousel:
import Carousel from 'nuka-carousel';
<Carousel>
<img src="image1.jpg" alt="Slide 1" />
<img src="image2.jpg" alt="Slide 2" />
<img src="image3.jpg" alt="Slide 3" />
</Carousel>
react-slick:
import Slider from 'react-slick';
<Slider>
<div><img src="image1.jpg" alt="Slide 1" /></div>
<div><img src="image2.jpg" alt="Slide 2" /></div>
<div><img src="image3.jpg" alt="Slide 3" /></div>
</Slider>
Both libraries offer similar basic usage, but nuka-carousel provides more granular control over carousel behavior through props and callbacks. react-slick, on the other hand, offers a wider range of pre-built features and options out of the box.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
react-slick
Carousel component built with React. It is a react port of slick carousel
Documentation
Installation
npm
npm install react-slick --save
yarn
yarn add react-slick
Also install slick-carousel for css and font
npm install slick-carousel
// Import css files
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";
or add cdn link in your html
<link
rel="stylesheet"
type="text/css"
charset="UTF-8"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css"
/>
PlayGround
Example
import React from "react";
import Slider from "react-slick";
export default function SimpleSlider() {
var settings = {
dots: true,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1
};
return (
<Slider {...settings}>
<div>
<h3>1</h3>
</div>
<div>
<h3>2</h3>
</div>
<div>
<h3>3</h3>
</div>
<div>
<h3>4</h3>
</div>
<div>
<h3>5</h3>
</div>
<div>
<h3>6</h3>
</div>
</Slider>
);
}
Props
For all available props, go here.
Methods
For all available methods, go here
Development
Want to run demos locally
git clone https://github.com/akiran/react-slick
cd react-slick
npm install
npm start
open http://localhost:8080
Community
Join our discord channel to discuss react-slick bugs and ask for help
Contributing
Please see the contributing guidelines
Top Related Projects
Most modern mobile touch slider with hardware accelerated transitions
the last carousel you'll ever need
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
A lightweight carousel library with fluid motion and great swipe precision.
Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot