@toneflix-code/flickity-vue
v1.0.1
Published
[![npm](https://img.shields.io/npm/v/@toneflix-code/flickity-vue.svg?style=flat-square)](https://www.npmjs.com/package/@toneflix-code/flickity-vue) [![npm](https://img.shields.io/npm/dt/@toneflix-code/flickity-vue.svg?style=flat-square)](https://www.npmjs
Downloads
81
Readme
Flickity for Vue.js 3
A Vue 3 Component for Flickity.js - See a live demo here.
Vue support
Supports only Vue >= 3
Installation and usage
See official documentation here.
$ npm i @toneflix-code/flickity-vue
import { createApp } from "vue";
import App from "./App.vue";
import flickity from "@toneflix-code/flickity-vue";
createApp(App).use(flickity).mount("#app");
new Vue({
components: {
FlickityMain,
FlickityCell,
},
data() {
return {
flickityOptions: {
initialIndex: 3,
prevNextButtons: false,
pageDots: false,
wrapAround: true,
// any options from Flickity can be used
},
};
},
});
<flickity ref="flickity" :options="flickityOptions">
<flickity-cell>1</flickity-cell>
<flickity-cell>2</flickity-cell>
<flickity-cell>3</flickity-cell>
<flickity-cell>4</flickity-cell>
<flickity-cell>5</flickity-cell>
</flickity>
<!-- if you don't want to use the buttons Flickity provides -->
<button @click="$refs.flickity.previous()">Custom Previous Button</button>
<button @click="$refs.flickity.next()">Custom Next Button</button>
Configuring with props
Any options from Flickity can be passed a props
<flickity
ref="flickity"
prev-next-buttons
page-dots
wrap-around
:initial-index="3"
>
<flickity-cell>1</flickity-cell>
<flickity-cell>2</flickity-cell>
<flickity-cell>3</flickity-cell>
<flickity-cell>4</flickity-cell>
<flickity-cell>5</flickity-cell>
</flickity>