Swiper
~45kb gzipped (JS) + ~15kb CSSTouch-friendly slider with built-in effects, pagination, and a11y.
See It in Action
Each demo drops Swiper behind a <ul> of slides and turns on a different effect. Try dragging, tapping the dots, or using the arrow keys.
The classic slider: drag to scroll, tap the dots or arrows, or use arrow keys. One config, zero CSS beyond defaults.
What is Swiper?
Swiper is a JavaScript slider library that handles touch gestures, mouse drag, keyboard navigation, and accessibility out of the box. You drop it behind an HTML list, turn on the modules you need (pagination, navigation, autoplay, effects), and you get a production-ready slider without writing animation code.
It ships with 8+ built-in effects (slide, fade, cube, coverflow, flip, cards, creative, and more) and has been the default slider for vanilla HTML projects since 2014. The bundle file includes every module in one script and one stylesheet -- drop it into a page and start building.
When to Use Swiper
How Swiper Compares
Embla is the modern headless choice -- smaller API, no built-in styles, maximum customization. Swiper is feature-rich and ready to drop in with effects like coverflow and cube. Pick Swiper for vanilla HTML projects; pick Embla if you want to build custom UI on top.
Flickity is GPL-3.0 licensed -- a non-starter for most commercial projects. Swiper is MIT. Unless you already have a Flickity license, there is no reason to pick it.
scroll-snap is a great zero-dependency choice for simple gallery scrolling. It cannot do effects like coverflow, does not include pagination dots or nav arrows, and has less consistent behavior across browsers. Use CSS for simple cases; Swiper when you need effects or a polished UI.
Get Started with Swiper
npm install swiper
yarn add swiper
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/swiper-bundle.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/swiper-bundle.min.js"></script>
<!-- In your <head> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/swiper-bundle.min.css">
<!-- In your <body> -->
<div class="swiper my-slider">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/swiper-bundle.min.js"></script>
<script>
const swiper = new Swiper(".my-slider", {
loop: true,
pagination: { el: ".swiper-pagination", clickable: true },
navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev" },
keyboard: { enabled: true }
});
</script>