vue-snap
v0.7.1
Published
Lightweight Carousel based on CSS Scroll Snap
Downloads
2,175
Maintainers
Readme
vue-snap
Lightweight Carousel based on CSS Scroll Snap.
Table of Contents
About
Idea behind this plugin is that to create fully responsive and well optimised Carousel. We used new CSS properties Scroll Snapping, which allows us to lock the Carousel Wrapper to certain Slides or locations after a user has finished scrolling. This helps us to minimize library size, with only critical part, and avoid any heavy JS calculations or any CSS Hacks inside.
Examples/Stories
Pros:
- Lightweight (5-10x times lighter than other libs)
- There is no calculation or heavy logic inside (Performence aspect)
- Fully responsive and mostly all customization via CSS - like how many Slides do you want to display
- ESM Bundle with Dead Code Elimination (Tree Shaking)
- SSR Support like Nuxt.js 🎉 (More here)
Vue@3
andVue@2
Support 🎉 (More here)- Support all modern/common browsers (More here)
Installation & Usage
Vue@3
version
Installation
yarn add vue-snap@next // or npm install vue-snap@next
Usage - Globally
import { createApp } from 'vue'
import App from './App.vue'
import VueSnap from 'vue-snap'
import 'vue-snap/dist/vue-snap.css'
const myApp = createApp(App)
myApp.use(VueSnap)
myApp.mount('#app')
Usage - Locally
import { Carousel, Slide } from 'vue-snap'
import 'vue-snap/dist/vue-snap.css'
export default {
components: {
Carousel,
Slide
}
}
Vue@2
version
Installation
yarn add vue-snap // or npm install vue-snap
Usage - Globally
import Vue from 'vue'
import VueSnap from 'vue-snap'
import 'vue-snap/dist/vue-snap.css'
Vue.use(VueSnap)
Usage - Locally
import { Carousel, Slide } from 'vue-snap'
import 'vue-snap/dist/vue-snap.css'
export default {
components: {
Carousel,
Slide
}
}
Examples usage
Check out examples folder for more details.
Development
Install necessary depandancies
yarn // or npm install
Run Storybook for development mode
yarn storybook:dev
Release
yarn release
Contribution
If you have a feature request then feel free to start a new issue, or just grab existing one.
License
MIT