# vue-carousel-generic

> Generic vue carousel component which makes minimum assumptions on appearance. It just provides the core carousel functionality.

Latest version **0.1.8** (published 2021-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-carousel-generic
pnpm add vue-carousel-generic
yarn add vue-carousel-generic
bun add vue-carousel-generic
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2021-09-28 |
| First published | 2020-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 979.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Artem Fedulov |
| Maintainers | arfedulov |
| Keywords | vue, carousel, swiper |

## Links

- npm: https://www.npmjs.com/package/vue-carousel-generic
- Repository: https://github.com/arfedulov/vue-carousel-generic
- Homepage: https://github.com/arfedulov/vue-carousel-generic#readme
- Issues: https://github.com/arfedulov/vue-carousel-generic/issues
- npm.io page: https://npm.io/package/vue-carousel-generic

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.6.11
- [core-js](https://npm.io/package/core-js.md) ^3.6.5

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 0.1.8 (latest) — 2021-09-28
- 0.1.7 — 2020-10-08
- 0.1.6 — 2020-10-05
- 0.1.4 — 2020-10-05
- 0.1.3 — 2020-10-05
- 0.1.2 — 2020-10-04
- 0.1.1 — 2020-10-04
- 0.1.0 — 2020-10-04

## README

# vue-carousel-generic

Generic vue carousel component which makes minimum assumptions on appearance. It just provides the core carousel functionality.

## Installation:

```
npm i vue-carousel-generic
```

## Usage example:

```html
<template>
  <div>
    <h1>Example</h1>
    <vue-carousel
      class="carousel"
      :items="items"
      :current-item="current"
      :visible-at-a-time="[1]"
      :speed="1"
      @carousel-move="updateCurrentItem"
    >
      <template v-slot:item="{ item }">
        <div class="carousel__item">{{ item }}</div>
      </template>
    </vue-carousel>
    <button @click="updateCurrentItem(-1)">&langle;</button>
    <button @click="updateCurrentItem(1)">&rangle;</button>
  </div>
</template>

<script>
import VueCarousel from "vue-carousel-generic";

export default {
  components: { VueCarousel },
  data() {
    return {
      items: [
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9",
        "10",
        "11",
        "12"
      ],
      current: 0
    };
  },
  methods: {
    updateCurrentItem(dir) {
      const newPos = this.current + dir;

      if (dir < 0) {
        this.current = newPos >= 0 ? newPos : 0;

        return;
      }

      this.current =
        newPos < this.items.length ? newPos : this.items.length - 1;
    }
  }
};
</script>
```

## Props

- `items` - **required** - a list of elements to fill a carousel with;
- `current-item` - **required** the position number of the currently displayed item
 (in case more than one item is visible at a time, `currentNumber` represents
 the position number of the first of visible elements);
- `visible-at-aTime` - **default:** `[1]` - a list of numbers which represent element's fractions displayed
 in carousel in one slide (e.g. `[0.5, 1, 0.5]` means that on each slide there is half
 of the first element, full second element, half of the third element).
- `step` - **default:** `1` - carousel step;
- `speed` - **default:** `1` - the speed of the carousel;
- `swipe-threshold` - **default:** `20` - the threshold in `px` for swipe events to fire;
- `swipe-timeout` - **default:** `500` - the maximum length in `ms` of a single swipe;
- `touch-only-swipes` - **default:** `false` - if `true`, swipe events will only fire on
 touch devices
- `swipeTimingFunction` - **default:** `ease-out` - css timing function for swipe transition
 
 ## Slots
 
 - `item` - a single element in carousel (slot props: `{ item: any }`)

## Events

- `carousel-move` - Payload: `number` - an index offset (negative for moving backwards);

---
_Source: https://npm.io/package/vue-carousel-generic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
