# react-latte-carousel

> LatteCarousel is a lightweight and responsive carousel.

Latest version **1.3.0** (published 2020-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-latte-carousel
pnpm add react-latte-carousel
yarn add react-latte-carousel
bun add react-latte-carousel
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2020-04-24 |
| First published | 2018-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 52.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | LatteCarousel |
| Maintainers | felipefg |
| Keywords | carousel, responsive, react, javascript, slider, typescript |

## Links

- npm: https://www.npmjs.com/package/react-latte-carousel
- Repository: https://github.com/latte-carousel/react-latte-carousel
- Homepage: https://lattecarousel.dev
- Issues: https://github.com/latte-carousel/react-latte-carousel/issues
- npm.io page: https://npm.io/package/react-latte-carousel

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2020-04-24
- 1.2.2 — 2019-09-29
- 1.2.1 — 2019-06-23
- 1.2.0 — 2019-03-21
- 1.1.0 — 2018-10-20
- 1.0.0 — 2018-10-11
- 0.10.0 — 2018-08-19
- 0.9.0 — 2018-08-11

## README

[![Build Status](https://travis-ci.com/latte-carousel/react-latte-carousel.svg?branch=master)](https://travis-ci.com/latte-carousel/react-latte-carousel)
[![npm](https://img.shields.io/npm/v/react-latte-carousel.svg)](https://npmjs.com/package/react-latte-carousel)
[![npm](https://img.shields.io/npm/l/react-latte-carousel.svg)](https://github.com/latte-carousel/react-latte-carousel/blob/master/LICENSE)

<p align="center">
    <img src="https://lattecarousel.dev/img/colored_small.png" alt="LatteCarousel"/>
</p>

# About

LatteCarousel is a lightweight and responsive carousel without any dependencies.

## Warning

This is a wrapper component for LatteCarousel and not a full rewrite in React.

This should be used only to display components that don't require DOM events.

React events will not work because of DOM manipulation inside latte-carousel.

## Usage

There are two ways for using react-latte-carousel:

-   Include both latte-carousel and react-latte-carousel packages and import using ES6 with Babel or Webpack.
-   Include both UMD (Universal Module Definition) files and use it directly.

This package already includes .d.ts files.

```html
<!-- UMD - Package -->
<link rel="stylesheet" href="latte-carousel.min.css" />
<script src="latte-carousel.min.js"></script>
<script src="react-latte-carousel.min.js"></script>

<!-- UMD - CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/latte-carousel@1.6.1/dist/latte-carousel.min.css" />
<script src="https://cdn.jsdelivr.net/npm/latte-carousel@1.6.1/dist/latte-carousel.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-latte-carousel@1.3.0/dist/react-latte-carousel.min.js"></script>
```

```jsx
<!-- ES6 -->
import { LatteCarousel, LatteItem } from "react-latte-carousel";

<!-- UMD -->
const LatteCarousel = ReactLatte.LatteCarousel;
const LatteItem = ReactLatte.LatteItem;
```

```jsx
render() {
    const options = this.getOptions();

    return (
        <LatteCarousel options={options}>
            <LatteItem>
                <div>1</div>
            </LatteItem>

            <LatteItem>
                <div>2</div>
            </LatteItem>

            <LatteItem>
                <div>3</div>
            </LatteItem>

            <LatteItem>
                <div>4</div>
            </LatteItem>

            <LatteItem>
                <div>5</div>
            </LatteItem>

            <LatteItem>
                <div>6</div>
            </LatteItem>
        </LatteCarousel>
    );
}
```

```jsx
getOptions() {
    return {
        count: 3,
        move: 1,
        touch: true,
        mode: "align",
        buttons: true,
        dots: true,
        rewind: true,
        autoplay: 0,
        animation: 500,
        responsive: {
            "0": { count: 1.5, mode: "free", buttons: false },
            "480": { count: 2.5, mode: "free", buttons: false },
            "768": { count: 3, move: 3, touch: false, dots: false },
            "1440": { count: 4, move: 2, touch: false, dots: false },
        },
    };
}
```

## Options

| Name       | Type                 | Default   | Description                            |
| ---------- | -------------------- | --------- | -------------------------------------- |
| count      | Number               | 3         | Number of visible items                |
| move       | Number               | 1         | Number of items to scroll              |
| touch      | Boolean              | false     | Enable touch support                   |
| mode       | String [align, free] | "align"   | Align animation to grid (touch only)   |
| buttons    | Boolean              | true      | Enable carousel buttons                |
| dots       | Boolean              | false     | Enable carousel dots                   |
| rewind     | Boolean              | true      | Enable rewind at the end (or start)    |
| autoplay   | Number               | 0         | Autoplay time in millis (0 to disable) |
| animation  | Number               | 500       | Animation time in millis               |
| responsive | Map<String, Object>  | undefined | Map of options for each breakpoint     |

## Features

-   [x] Responsive options
-   [x] Touch support
-   [x] Stage padding
-   [x] Navigation dots
-   [x] Rewind carousel
-   [x] Autoplay carousel
-   [x] Carousel events

## Build

Install dependencies:

```sh
yarn install
```

Build project:

```sh
yarn run build
```

Run example:

```sh
yarn run serve

open http://localhost:8080/example
```

Result files:

-   dist/react-latte-carousel.min.js

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