Convert Figma logo to code with AI

Splidejs logosplide

Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.

4,828
418
4,828
116

Top Related Projects

39,523

Most modern mobile touch slider with hardware accelerated transitions

7,271

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

28,370

the last carousel you'll ever need

A modern, beautiful, customizable date picker for React

A lightweight carousel library with fluid motion and great swipe precision.

Quick Overview

Splide is a lightweight, flexible, and accessible JavaScript slider and carousel library. It offers a smooth and customizable sliding experience with no dependencies, making it ideal for various web projects.

Pros

  • Lightweight and fast, with no dependencies
  • Highly customizable with numerous options and API methods
  • Responsive and touch-friendly, working well on mobile devices
  • Accessible, following WCAG 2.1 guidelines

Cons

  • Limited built-in effects compared to some more complex slider libraries
  • Documentation could be more comprehensive for advanced use cases
  • May require additional custom code for complex layouts or animations

Code Examples

Creating a basic slider:

import Splide from '@splidejs/splide';

new Splide('.splide').mount();

Adding custom navigation:

new Splide('.splide', {
  arrows: false,
  pagination: false,
}).mount();

document.querySelector('.custom-next').addEventListener('click', () => {
  splide.go('+1');
});

Creating a carousel with multiple slides per view:

new Splide('.splide', {
  type: 'loop',
  perPage: 3,
  perMove: 1,
  gap: '1rem',
}).mount();

Getting Started

  1. Install Splide via npm:
npm install @splidejs/splide
  1. Import and initialize Splide in your JavaScript file:
import Splide from '@splidejs/splide';
import '@splidejs/splide/css';

document.addEventListener('DOMContentLoaded', function() {
  new Splide('.splide', {
    type: 'loop',
    perPage: 3,
    perMove: 1,
  }).mount();
});
  1. Add the HTML structure to your page:
<div class="splide">
  <div class="splide__track">
    <ul class="splide__list">
      <li class="splide__slide">Slide 1</li>
      <li class="splide__slide">Slide 2</li>
      <li class="splide__slide">Slide 3</li>
    </ul>
  </div>
</div>

Competitor Comparisons

39,523

Most modern mobile touch slider with hardware accelerated transitions

Pros of Swiper

  • More extensive feature set, including 3D effects and parallax scrolling
  • Larger community and ecosystem, with more plugins and extensions available
  • Better support for older browsers and wider device compatibility

Cons of Swiper

  • Larger file size and potentially higher performance overhead
  • More complex API and steeper learning curve for beginners
  • Requires additional CSS file for styling, increasing setup complexity

Code Comparison

Splide initialization:

new Splide('.splide', {
  type: 'loop',
  perPage: 3,
  autoplay: true
}).mount();

Swiper initialization:

new Swiper('.swiper', {
  loop: true,
  slidesPerView: 3,
  autoplay: {
    delay: 3000,
  },
});

Both libraries offer similar basic functionality, but Swiper's initialization typically requires more configuration options. Splide's API is generally more concise and intuitive for simple use cases.

While Swiper provides more advanced features out of the box, Splide focuses on lightweight performance and ease of use. The choice between the two depends on project requirements, with Swiper being better suited for complex, feature-rich sliders, and Splide excelling in simpler, performance-critical applications.

7,271

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

Pros of Glide

  • Smaller file size (26KB vs 64KB for Splide)
  • Simpler API with fewer options, making it easier to learn and implement
  • Better support for older browsers (IE10+)

Cons of Glide

  • Less frequent updates and maintenance compared to Splide
  • Fewer built-in features and extensions
  • Limited touch and mouse drag support

Code Comparison

Glide initialization:

new Glide('.glide').mount()

Splide initialization:

new Splide('.splide').mount()

Both libraries have similar initialization syntax, but Splide offers more customization options:

new Splide('.splide', {
  type: 'loop',
  perPage: 3,
  autoplay: true
}).mount()

Glide and Splide are both JavaScript slider libraries that provide similar core functionality. Glide is lighter and simpler, making it a good choice for basic slider needs and projects requiring support for older browsers. Splide, while larger, offers more features, better performance, and more frequent updates, making it suitable for complex and modern web applications. The choice between the two depends on the specific project requirements and target audience.

28,370

the last carousel you'll ever need

Pros of Slick

  • Extensive browser support, including older versions of Internet Explorer
  • Large community and ecosystem with numerous plugins and extensions
  • Simple and intuitive API for basic carousel functionality

Cons of Slick

  • Relies on jQuery, which may be a drawback for modern projects
  • Less performant compared to newer, vanilla JavaScript alternatives
  • Limited built-in responsive options and customization features

Code Comparison

Slick initialization:

$('.slider').slick({
  slidesToShow: 3,
  slidesToScroll: 1,
  autoplay: true
});

Splide initialization:

new Splide('.splide', {
  perPage: 3,
  perMove: 1,
  autoplay: true
}).mount();

Both libraries offer similar basic functionality, but Splide provides a more modern, vanilla JavaScript approach. Slick's reliance on jQuery may be familiar to some developers but can be seen as outdated for newer projects.

Splide offers better performance, more customization options, and a smaller file size. It also provides built-in TypeScript support and a more flexible API for advanced use cases.

While Slick has a larger community and more third-party extensions, Splide is actively maintained and growing in popularity, making it a strong contender for modern web development projects.

A modern, beautiful, customizable date picker for React

Pros of react-modern-calendar-datepicker

  • Specifically designed for React applications, offering seamless integration
  • Provides a modern and customizable calendar interface for date picking
  • Supports multiple languages and localization out of the box

Cons of react-modern-calendar-datepicker

  • Limited to date picking functionality, unlike Splide's versatile carousel/slider capabilities
  • May have a steeper learning curve for developers not familiar with React

Code Comparison

react-modern-calendar-datepicker:

import DatePicker from 'react-modern-calendar-datepicker';

const MyComponent = () => (
  <DatePicker
    value={selectedDay}
    onChange={setSelectedDay}
    inputPlaceholder="Select a day"
  />
);

Splide:

import Splide from '@splidejs/splide';

new Splide('.splide', {
  type: 'loop',
  perPage: 3,
  autoplay: true,
}).mount();

While react-modern-calendar-datepicker focuses on providing a React-specific date picking solution, Splide offers a more general-purpose slider/carousel functionality that can be used in various contexts. The code examples highlight the different use cases and implementation approaches of these two libraries.

A lightweight carousel library with fluid motion and great swipe precision.

Pros of Embla Carousel

  • Lightweight and performant, with a smaller bundle size
  • Highly customizable with a plugin system
  • Supports touch gestures and smooth animations out of the box

Cons of Embla Carousel

  • Less extensive documentation compared to Splide
  • Fewer built-in features and options
  • Steeper learning curve for beginners

Code Comparison

Splide initialization:

new Splide('.splide', {
  type: 'loop',
  perPage: 3,
  autoplay: true
}).mount();

Embla Carousel initialization:

const embla = EmblaCarousel(emblaNode, {
  loop: true,
  slidesToScroll: 3,
  autoplay: true
});

Both carousels offer similar basic functionality, but Embla Carousel requires more manual setup for advanced features. Splide provides more built-in options, making it easier to configure complex carousels with less code.

Embla Carousel's plugin system allows for greater flexibility and customization, but it may require more effort to achieve the same results as Splide's built-in features. Splide's extensive documentation and examples make it more accessible for beginners, while Embla Carousel's lightweight nature and performance optimizations appeal to developers prioritizing speed and customization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Splide

Splide

Splide is a lightweight, flexible and accessible slider and carousel.
No dependencies, no Lighthouse errors.

Download
Getting Started
Demo
Documents
Themes
About v4
Discussions/Q&A

Ready For

React Splide React Splide React Splide Vue Splide Vue Splide

Extensions

Auto Scroll ・ Intersection ・ Grid ・ Video ・ URL Hash

Translation

日本語

Support Splide

Please support the project if you like it!

Features

  • Written in TypeScript
  • No dependencies
  • Lightweight, 29kB (12kB gzipped)
  • Flexible and extensible
  • Protected by 400+ test cases
  • Multiple slides
  • Slide or fade transition by CSS
  • Supports breakpoints
  • Accepts CSS relative units
  • Autoplay with progress bar and a play-pause toggle button
  • RTL and vertical direction
  • Mouse drag and touch swipe
  • Free drag mode
  • Mouse wheel navigation
  • Nested slider
  • Lazy loading
  • Thumbnail slider
  • Auto width and height
  • Accessibility friendly
  • Live Region
  • Internet Explorer 10

No Lighthouse Errors

Here is the mobile version result of the Splide front page:

Lighthouse result of the Splide frontpage

The Splide slider does not degrade Accessibility, Best Practices and SEO 🎉

License

Splide is released under MIT license. © 2022 Naotoshi Fujita

NPM DownloadsLast 30 Days