Swiper

A hardware-accelerated, mobile-first touch slider for carousels, galleries, and slideshows

Library
npm
v14.2.0
41,905 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
93 /100 Excellent
Development Activity 88
Maintenance 96
Community 88
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 87
Code Quality 88
Innovation 83
Learning Curve 75

Swiper is a touch slider library built for mobile-first, hardware-accelerated transitions, used to build carousels, image galleries, product sliders, and full-page slideshows. Its core is framework-agnostic vanilla JS/TypeScript, with official React, Vue, and native web-component (swiper-container/swiper-slide) bindings shipped from the same package.

The library is organized around a modular plugin system — effects (fade, cube, coverflow, flip), navigation, pagination, autoplay, virtual slides, and free-mode scrolling are all opt-in modules layered on top of a lean core, keeping bundle size down for consumers who only need basic slide behavior.

What You Get

  • A vanilla JS/TypeScript core with drag, swipe, and momentum-based touch handling
  • Official React and Vue component wrappers plus a native web-component build (<swiper-container>)
  • A modular plugin system for navigation, pagination, autoplay, virtual slides, and free-mode scrolling
  • Built-in transition effects: fade, cube, coverflow, flip, and cards
  • Responsive breakpoints and RTL layout support out of the box

Common Use Cases

  • E-commerce product image galleries and “you may also like” carousels
  • Full-page or hero image/content slideshows on marketing and landing pages
  • Mobile app-like swipeable onboarding screens and tab interfaces
  • Card-based UIs (testimonial carousels, feature showcases) using the built-in cards/coverflow effects

Under The Hood

Architecture: Swiper’s core (src/core/core.ts, ~1,400 lines) implements a class-based Swiper object that manages slide positioning, touch/drag event handling, transitions, and a lifecycle of internal update/translate/loop modules (src/core/update, src/core/translate, src/core/loop). Framework bindings (src/react, src/vue, swiper-element.ts) are thin adapters that wrap this same core class rather than reimplementing slider logic per framework, so behavior stays consistent across React, Vue, and vanilla usage.

Tech Stack: Written in TypeScript, compiled via a custom build script (scripts/build) rather than a standard bundler config, with oxfmt for formatting and tsc --noEmit for type-checking. No runtime dependencies — the core ships dependency-free by design to keep bundle size minimal.

Code Quality: The tests/ directory includes contract tests (dist-contract.test.mjs), SSR compatibility tests, DOM tests for the web-component build, and dedicated consumer-type-checking tests (consumer-types-test) that validate the published .d.ts files actually work for consumers — an unusually thorough type-safety net for a UI library. A bundle-size.js script also tracks output size regressions as part of CI.

API Design: The plugin/module system lets consumers import only the modules they need (e.g. Navigation, Pagination, Autoplay), keeping the base import small; this requires learning which modules exist, giving it a moderate learning curve, but the framework-native components (<Swiper>, <SwiperSlide> in React/Vue) make basic usage very approachable with minimal boilerplate.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers