Install & Download:
# Yarn
$ yarn add vue-card-stack
# NPM
$ npm install vue-card-stack --saveDescription:
A stack card component that allows the user to create swipeable, tweakable stacked cards on the web application.
Basic usage:
1. Import the vue-card-stack component after installation.
import Vue from "vue"; import VueCardStack from "vue-card-stack";
2. Add the component to the app template.
<vue-card-stack :cards="cards" :stack-width="480" :card-width="320">
<template v-slot:card="{ card }">
<div
style="width: 100%; height: 100%;"
:style="{ background: card.background }"
></div>
</template>
</vue-card-stack>3. Register the component and determine the background color for each card as follows:
export default {
components: {
VueCardStack
},
data() {
return {
cards: [
{ background: "#000" },
{ background: "#222" },
{ background: "#fff" },
{ background: "#333" },
{ background: "#666" }
]
};
}
};4. Possible props to customize the cards.
cards: {
type: Array,
default: () => []
},
cardWidth: {
type: Number,
default: () => 300
},
cardHeight: {
type: Number,
default: () => 400
},
stackWidth: {
type: [Number, String],
default: () => null
},
sensitivity: {
type: Number,
default: () => 0.25
},
maxVisibleCards: {
type: Number,
default: () => 10
},
scaleMultiplier: {
type: Number,
default: () => 0.5 // last visible card will be 50% scale
},
speed: {
type: Number,
default: () => 0.2
},
paddingHorizontal: {
type: Number,
default: () => 20
},
paddingVertical: {
type: Number,
default: () => 20
}Preview:

Changelog:
v1.4.0 (03/03/2022)
- Reset stack if card has not travelled minimum distance
v1.3.1 (12/10/2020)
- Fix computed props not updating
v1.3.0 (12/06/2020)
- feat(slots): add navigation slot