vue-ssr-carousel

A performance focused Vue carousel designed for SSR/SSG environments.

Install

yarn add vue-ssr-carousel

Default

import SsrCarousel from 'vue-ssr-carousel'
import ssrCarouselCss from 'vue-ssr-carousel/index.css'
Vue.component 'ssr-carousel', SsrCarousel

Nuxt

// nuxt.config.js
export default {
  buildModules: [ 'vue-ssr-carousel/nuxt' ]
}

Usage

<ssr-carousel>
  <div class="slide">Slide 1</div>
  <div class="slide">Slide 2</div>
  <div class="slide">Slide 3</div>
</ssr-carousel>

For more examples, see the demo: https://vue-ssr-carousel.netlify.app.

API

Props

Slots

  • default - Where your slides get injected.
  • back-arrow - Replace the default back icon. Slot props:
    • disabled - True if at first page when not looping.
  • next-arrow - Replace the default next icon. Slot props:
    • disabled - True if at first page when not looping.
  • dot - Replace the default pagination dots. Slot props:
    • index - The page index that the dot represents.
    • disabled - True if dot represents current page.

Methods

  • next() - Go forward a page or slide, depending on the paginate-by-slide prop
  • back() - Go back a page or slide, depending on the paginate-by-slide prop
  • goto(index) - Go to an index. If paginate-by-slide is false, this equates to a page offset. If true, this equates to a slide offset.

Events

See https://vue-ssr-carousel.netlify.app/events

  • change({ index }) - Fired when the internal index counter changes
  • press - Fired on mouse or touch down
  • release - Fired on mouse or touch up
  • drag:start - Fired on start of dragging
  • drag:end - Fired on end of dragging
  • tween:start({ index }) - Fired when the carousel starts tweening to it's final position
  • tween:end({ index }) - Fired when the carousel has finished tweening to it's destination.