Home

Awesome

vue-snap

Lightweight Carousel based on CSS Scroll Snap.

<div align="left"> <img width="750" heigth="250" src="/static/logo-snap.jpg" alt="vue-snap logo"> </div>

npm version Build Status npm bundle size license

<a href="https://www.buymeacoffee.com/bartdominiak"> <img src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg" alt="Buy Me a Coffee" height="32" > </a>

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:

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