# react-free-carousel

> Carousel component for free flex-box layout built with React.

Latest version **1.0.5** (published 2017-08-02) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2017-08-02 |
| First published | 2017-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Pavlo Vozniuk |
| Maintainers | pvoznyuk |
| Keywords | component, react-component, react |

## Links

- npm: https://www.npmjs.com/package/react-free-carousel
- Repository: https://github.com/pvoznyuk/react-free-carousel
- Issues: https://github.com/pvoznyuk/react-free-carousel/issues
- npm.io page: https://npm.io/package/react-free-carousel

## Dependencies (3)

- [lodash.debounce](https://npm.io/package/lodash.debounce.md) 4.0.8
- [lodash.capitalize](https://npm.io/package/lodash.capitalize.md) 4.2.1
- [styled-components](https://npm.io/package/styled-components.md) 2.1.1

## 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.0.5 (latest) — 2017-08-02
- 1.0.4 — 2017-08-02
- 1.0.3 — 2017-08-02
- 1.0.2 — 2017-08-02
- 1.0.1 — 2017-08-02
- 1.0.0 — 2017-08-02
- 0.2.8 — 2017-07-24
- 0.2.7 — 2017-07-24
- 0.2.6 — 2017-07-24
- 0.2.5 — 2017-07-24
- 0.2.4 — 2017-07-24
- 0.2.3 — 2017-07-24
- 0.2.2 — 2017-07-24
- 0.2.1 — 2017-07-24
- 0.2.0 — 2017-07-24
- … 11 more at https://npm.io/package/react-free-carousel/versions

## README

# react-free-carousel [![npm](https://img.shields.io/npm/v/react-free-carousel.svg?style=flat-square)](https://www.npmjs.com/package/react-free-carousel)

[![Dependencies](https://img.shields.io/david/pvoznyuk/react-free-carousel.svg?style=flat-square)](https://david-dm.org/pvoznyuk/react-free-carousel)
[![Dev Dependencies](https://img.shields.io/david/dev/pvoznyuk/react-free-carousel.svg?style=flat-square)](https://david-dm.org/pvoznyuk/react-free-carousel#info=devDependencies)

Carousel component for free flex-box tile layout built with React.

## Installation

### NPM
```sh
npm install --save react react-free-carousel
```

Don't forget to manually install peer dependencies (`react`) if you use npm@3.

## Demo

[http://pvoznyuk.github.io/react-free-carousel](http://pvoznyuk.github.io/react-free-carousel)

<img src="https://github.com/pvoznyuk/react-free-carousel/blob/master/src/example/example.gif?raw=true" alt="demo" />


## Usage

### Carousel with custom tiles
```js
import React from 'react';
import ReactDOM from 'react-dom';
import ReactFreeCarousel from 'react-free-carousel';

const App = () => (
  <div>
    <ReactFreeCarousel width={'600px'} height={'400px'}>
      <div className={css.smallTileClass}>1</div>
      <div className={css.smallTileClass}>2</div>
      <div className={css.mediumTileClass}>3</div>
      <div className={css.mediumTileClass}>4</div>
      <div className={css.bigTileClass}>5</div>
      <div className={css.bigTileClass}>6</div>
    </ReactFreeCarousel>
  </div>
);

const appRoot = document.createElement('div');
document.body.appendChild(appRoot);
ReactDOM.render(<App />, appRoot);
```

### Carousel with ReactFreeCarousel.Tile
```js
import React from 'react';
import ReactDOM from 'react-dom';
import ReactFreeCarousel from 'react-free-carousel';

const App = () => (
  <div style={{width: '70vw', height: '30vh'}}>
    <ReactFreeCarousel
      arrows={true}
      autoplay={false}
      tileMargin={10}>
      <ReactFreeCarousel.Tile width={140} height={'100%'}>Tile 1</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={280} height={'50%'}>Tile 2</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={280} height={'50%'}>Tile 3</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={'50%'} height={'100%'}>Tile 4</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={'25%'} height={`${100/3}%`}>Tile 5</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={'25%'} height={`${100/3}%`}>Tile 6</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={'25%'} height={`${100/3}%`}>Tile 7</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={'25%'} height="50%">Tile 8</ReactFreeCarousel.Tile>
      <ReactFreeCarousel.Tile width={'25%'} height="50%">Tile 9</ReactFreeCarousel.Tile>
    </ReactFreeCarousel>
  </div>
);

const appRoot = document.createElement('div');
document.body.appendChild(appRoot);
ReactDOM.render(<App />, appRoot);
```

### Properties

#### ReactFreeCarousel

| Propertie                  | Type                | Default Value | Description |
|----------------------------|---------------------|---------------|-------------|
| `className`                | string              | null          | Just className.
| `interval`                 | number              | 5000          | Slide changing interval.
| `transitionSpeed`          | number              | 500           | Slide changing speed.
| `height`                   | string or number    | '100%'        | Carousel height.
| `width`                    | string or number    | '100%'        | Carousel width.
| `tileMargin`               | string or number    | 0             | Margin between `ReactFreeCarousel.Tile` tiles.
| `autoplay`                 | boolean             | true          | Autostart carousel.
| `page`                     | number              | 0             | Page to show (0-indexed).
| `slide`                    | number              | null          | Slide to scroll to (0-indexed).
| `showPagination`           | boolean             | true          | Show pagination.
| `minPagesToShowPagination` | number              | 2             | Min number of page to show the pagination.
| `paginationClass`          | string              | ''            | Pagination className.
| `paginationDotClass`       | string              | ''            | Pagination dot className.
| `paginationDotActiveClass` | string              | ''            | Pagination active dot className.
| `arrows`                   | boolean             | false         | Show/hide the prev/next arrows.
| `arrowPrevClass`           | string              | ''            | Previous button className.
| `arrowNextClass`           | string              | ''            | Next button className.

#### ReactFreeCarousel.Tile

| Propertie                  | Type                | Default Value | Description |
|----------------------------|---------------------|---------------|-------------|
| `className`                | string              | null          | Tile custom className.
| `height`                   | string or number    | '100%'        | Tile height.
| `width`                    | string or number    | '100%'        | Tile width.


## Development and testing

Currently is being developed and tested with the latest stable `Node 5` on `OSX` and `Windows`.

To run example covering all `ReactFreeCarousel` features, use `npm start dev`, which will compile `src/example/Example.js`

```bash
git clone git@github.com:pvoznyuk/react-free-carousel.git
cd react-free-carousel
npm install
npm start dev

# then
open http://localhost:8080
```

## Tests

```bash
# to run tests
npm start test

# to generate test coverage (./reports/coverage)
npm start test.cov

# to run end-to-end tests
npm start test.e2e
```

## License

MIT

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