Top Related Projects
Most modern mobile touch slider with hardware accelerated transitions
A library to use idangerous Swiper as a ReactJs component which allows Swiper's modules custom build
The best Swiper component for React Native.
🎠 A carousel component for Vue.js
Quick Overview
Vue-awesome-swiper is a Vue.js wrapper component for the popular Swiper.js library. It allows developers to easily integrate touch-enabled sliders and carousels into their Vue applications, providing a smooth and responsive user experience across various devices and platforms.
Pros
- Seamless integration with Vue.js projects
- Supports both Vue 2 and Vue 3
- Extensive customization options and API support
- Regular updates and active maintenance
Cons
- Learning curve for complex configurations
- Potential performance issues with large datasets
- Dependency on external Swiper.js library
- Some features may require additional plugins
Code Examples
- Basic Swiper setup:
<template>
<swiper
:slides-per-view="3"
:space-between="50"
@swiper="onSwiper"
@slideChange="onSlideChange"
>
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
</swiper>
</template>
<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
import 'swiper/css'
export default {
components: {
Swiper,
SwiperSlide,
},
methods: {
onSwiper(swiper) {
console.log(swiper)
},
onSlideChange() {
console.log('slide change')
},
},
}
</script>
- Pagination and navigation:
<template>
<swiper
:pagination="{ clickable: true }"
:navigation="true"
:modules="modules"
class="mySwiper"
>
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
</swiper>
</template>
<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
import { Navigation, Pagination } from 'swiper/modules'
import 'swiper/css'
import 'swiper/css/navigation'
import 'swiper/css/pagination'
export default {
components: {
Swiper,
SwiperSlide,
},
setup() {
return {
modules: [Navigation, Pagination],
}
},
}
</script>
- Responsive breakpoints:
<template>
<swiper
:breakpoints="swiperOptions.breakpoints"
:modules="modules"
>
<swiper-slide v-for="slide in slides" :key="slide.id">
{{ slide.content }}
</swiper-slide>
</swiper>
</template>
<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
import { Pagination } from 'swiper/modules'
import 'swiper/css'
import 'swiper/css/pagination'
export default {
components: {
Swiper,
SwiperSlide,
},
setup() {
return {
modules: [Pagination],
swiperOptions: {
breakpoints: {
320: {
slidesPerView: 1,
spaceBetween: 10,
},
768: {
slidesPerView: 2,
spaceBetween: 20,
},
1024: {
slidesPerView: 3,
spaceBetween: 30,
},
},
},
slides: [
{ id: 1, content: 'Slide 1' },
{ id: 2, content: 'Slide 2' },
{ id: 3
Competitor Comparisons
Most modern mobile touch slider with hardware accelerated transitions
Pros of Swiper
- More comprehensive and feature-rich, offering a wider range of functionalities
- Better performance and smoother animations
- Regular updates and active maintenance by the core team
Cons of Swiper
- Steeper learning curve due to more complex API
- Larger file size, which may impact page load times
- Not specifically designed for Vue.js, requiring additional setup
Code Comparison
Vue-awesome-swiper:
<template>
<swiper :options="swiperOptions">
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
</swiper>
</template>
Swiper:
import Swiper from 'swiper';
const swiper = new Swiper('.swiper-container', {
slidesPerView: 3,
spaceBetween: 30,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
Vue-awesome-swiper is a Vue.js wrapper for Swiper, providing a more Vue-friendly integration. It offers easier implementation in Vue projects but may lack some advanced features. Swiper, on the other hand, is the core library with more flexibility and power, but requires additional setup for Vue.js projects. The choice between the two depends on project requirements and developer preferences.
A library to use idangerous Swiper as a ReactJs component which allows Swiper's modules custom build
Pros of react-id-swiper
- Built specifically for React, ensuring seamless integration with React components
- Supports TypeScript out of the box, providing better type checking and developer experience
- Offers a more React-like API, making it easier for React developers to use and customize
Cons of react-id-swiper
- Less frequently updated compared to vue-awesome-swiper
- Smaller community and fewer contributors, potentially leading to slower issue resolution
- May have fewer features or customization options compared to vue-awesome-swiper
Code Comparison
react-id-swiper:
import Swiper from 'react-id-swiper';
const MyComponent = () => (
<Swiper>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
</Swiper>
);
vue-awesome-swiper:
<template>
<swiper>
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
</swiper>
</template>
<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper';
</script>
Both libraries provide a similar API for basic usage, but react-id-swiper uses React components directly, while vue-awesome-swiper uses Vue-specific components. The vue-awesome-swiper example shows a more Vue-like structure with separate template and script sections.
The best Swiper component for React Native.
Pros of react-native-swiper
- Specifically designed for React Native, ensuring better compatibility with mobile apps
- Includes mobile-specific features like pagination and autoplay
- Lightweight and focused on essential swiper functionality for mobile
Cons of react-native-swiper
- Less frequently updated compared to vue-awesome-swiper
- More limited customization options and fewer advanced features
- Smaller community and fewer resources available for troubleshooting
Code Comparison
react-native-swiper:
<Swiper
showsButtons={true}
autoplay={true}
horizontal={true}
>
<View style={styles.slide1}><Text>Slide 1</Text></View>
<View style={styles.slide2}><Text>Slide 2</Text></View>
</Swiper>
vue-awesome-swiper:
<swiper :options="swiperOption">
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
Both libraries offer similar basic functionality, but vue-awesome-swiper provides more extensive options and is better suited for web applications. react-native-swiper is tailored for mobile development with React Native, offering a more streamlined approach for mobile-specific use cases.
🎠 A carousel component for Vue.js
Pros of vue-agile
- Lightweight and focused on Vue.js integration
- Built-in responsive breakpoints for easier mobile-first design
- Supports touch events and swipe gestures out of the box
Cons of vue-agile
- Less feature-rich compared to vue-awesome-swiper
- Smaller community and potentially slower development cycle
- May require more custom styling for advanced carousel designs
Code Comparison
vue-agile:
<template>
<agile>
<div class="slide">Slide 1</div>
<div class="slide">Slide 2</div>
<div class="slide">Slide 3</div>
</agile>
</template>
vue-awesome-swiper:
<template>
<swiper :options="swiperOptions">
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
</swiper>
</template>
Both libraries offer simple implementation for basic carousel functionality. vue-agile uses a more Vue-centric approach with its <agile>
component, while vue-awesome-swiper closely follows Swiper.js conventions with <swiper>
and <swiper-slide>
components.
vue-awesome-swiper provides more customization options through the :options
prop, allowing for fine-tuned control over the carousel behavior. vue-agile, on the other hand, focuses on simplicity and ease of use, with many common options available as props on the <agile>
component itself.
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
vue-awesome-swiper
Swiper component for Vue.
DEPRECATED â ï¸
The vue-awesome-swiper project has been deprecated and superseded by Swiper Vue component, a TypeScript friendly project which is a recent official release provided by Swiper. For better stability, please migrate as soon as possible.
vue-awesome-swiper released its last version v5 for (bridge) transition. It's worth noting that APIs in this version are completely NOT compatible with that of previous version, it only re-exports swiper/vue
and only supports Vue3, which means only functions of swiper/vue
are available. For example, the following code is fully equivalent in vue-awesome-swiper@5
. And if you want to check update catelog of Swiper API, please refer to Swiper Changelog.
import { Swiper, SwiperSlide, /* rest swiper/vue API... */ } from 'vue-awesome-swiper'
// exactly equivalent to
import { Swiper, SwiperSlide, /* rest swiper/vue API... */ } from 'swiper/vue'
If you need to use older versions of vue-awesome-swiper, you can find the corresponding version number below. Feel free to fork our code and maintain your own copy.
Legacy versions
- Swiper 5-6 vue-awesome-swiper@4.1.1 (Vue2)
- Swiper 4.x vue-awesome-swiper@3.1.3 (Vue2)
- Swiper 3.x vue-awesome-swiper@2.6.7 (Vue2)
Documentation
How to use
Install
npm install swiper vue-awesome-swiper --save
yarn add swiper vue-awesome-swiper
Local component
<template>
<swiper :modules="modules" :pagination="{ clickable: true }">
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
</swiper>
</template>
<script>
import SwiperClass, { Pagination } from 'swiper'
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
// import swiper module styles
import 'swiper/css'
import 'swiper/css/pagination'
// more module style...
export default {
components: {
Swiper,
SwiperSlide
},
setup() {
return {
modules: [Pagination]
}
}
}
</script>
Global component
import { createApp } from 'vue'
import SwiperClass, { /* swiper modules... */ } from 'swiper'
import VueAwesomeSwiper from 'vue-awesome-swiper'
// import swiper module styles
import 'swiper/css'
// more module style...
// use swiper modules
SwiperClass.use([/* swiper modules... */])
const app = createApp()
app.use(VueAwesomeSwiper)
Component API
<!-- All options and events of the original Swiper are supported -->
<swiper
:modules="..."
:allow-touch-move="false"
:slides-per-view="1"
:autoplay="{ delay: 3500, disableOnInteraction: false }"
@swiper="..."
@slide-change="..."
@transition-start="..."
...
>
<template #container-start><span>Container start</span></template>
<template #wrapper-start><span>Wrapper start</span></template>
<swiper-slide>Slide 1<swiper-slide>
<swiper-slide v-slot="{ isActive }">Slide 2 {{ isActive }}<swiper-slide>
<swiper-slide>Slide 3<swiper-slide>
<template #wrapper-end><span>Wrapper end</span></template>
<template #container-end><span>Container end</span></template>
</swiper>
Changelog
Detailed changes for each release are documented in the release notes.
License
Licensed under the MIT License.
Top Related Projects
Most modern mobile touch slider with hardware accelerated transitions
A library to use idangerous Swiper as a ReactJs component which allows Swiper's modules custom build
The best Swiper component for React Native.
🎠 A carousel component for Vue.js
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