{"id":13756624,"url":"https://github.com/brainhubeu/react-carousel","last_synced_at":"2025-05-13T21:05:04.889Z","repository":{"id":28047385,"uuid":"116013398","full_name":"brainhubeu/react-carousel","owner":"brainhubeu","description":"A pure extendable React carousel, powered by Brainhub (craftsmen who ❤️ JS)","archived":false,"fork":false,"pushed_at":"2025-04-27T00:06:09.000Z","size":209522,"stargazers_count":1072,"open_issues_count":121,"forks_count":163,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-27T01:18:52.046Z","etag":null,"topics":["carousel","carousel-component","cypress","gatsby","jest","react","sass","slide","webpack"],"latest_commit_sha":null,"homepage":"https://brainhub.eu/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brainhubeu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-02T12:34:20.000Z","updated_at":"2025-03-25T17:39:15.000Z","dependencies_parsed_at":"2024-03-24T09:26:19.102Z","dependency_job_id":"23c3f90c-95ee-4d11-9def-02c1958dcc7c","html_url":"https://github.com/brainhubeu/react-carousel","commit_stats":{"total_commits":848,"total_committers":51,"mean_commits":"16.627450980392158","dds":0.6639150943396226,"last_synced_commit":"be0aeda9804f16fd7482e42a1b1010a7ec9bb302"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainhubeu%2Freact-carousel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainhubeu%2Freact-carousel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainhubeu%2Freact-carousel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainhubeu%2Freact-carousel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brainhubeu","download_url":"https://codeload.github.com/brainhubeu/react-carousel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251074001,"owners_count":21532083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carousel","carousel-component","cypress","gatsby","jest","react","sass","slide","webpack"],"created_at":"2024-08-03T11:00:49.412Z","updated_at":"2025-04-28T12:06:16.513Z","avatar_url":"https://github.com/brainhubeu.png","language":"JavaScript","funding_links":[],"categories":["React"],"sub_categories":["Carousel"],"readme":"\u003cbr/\u003e\n\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://brainhubeu.github.io/react-carousel/\"\u003e\n    \u003cimg src=\"https://github.com/brainhubeu/react-carousel/raw/master/readme/assets/logo.gif\" alt=\"\" width=\"200\"/\u003e\n  \u003c/a\u003e\n  \u003cbr/\u003e\n  react-carousel\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  A pure extendable React carousel, powered by \u003ca href=\"https://brainhub.eu/\"\u003eBrainhub\u003c/a\u003e (craftsmen who ❤️ JS) \n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e\n    \u003ca href=\"https://brainhubeu.github.io/react-carousel/\"\u003eLive code demo\u003c/a\u003e | \n    \u003ca href=\"https://brainhubeu.github.io/react-carousel/docs/migrationGuide\"\u003ev1 migration guide\u003c/a\u003e | \n    \u003ca href=\"https://brainhub.eu/contact/\"\u003eHire us\u003c/a\u003e\n  \u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n  [![CircleCI](https://circleci.com/gh/brainhubeu/react-carousel.svg?style=svg)](https://circleci.com/gh/brainhubeu/react-carousel)\n  [![Last commit](https://img.shields.io/github/last-commit/brainhubeu/react-carousel.svg)](https://github.com/brainhubeu/react-carousel/commits/master)\n  [![license](https://img.shields.io/npm/l/@brainhubeu/react-carousel.svg)](https://github.com/brainhubeu/react-carousel/blob/master/LICENSE.md)\n  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n  [![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)\n  \n  [![Coveralls github](https://img.shields.io/coveralls/github/brainhubeu/react-carousel.svg)](https://coveralls.io/github/brainhubeu/react-carousel?branch=master)\n  [![Downloads](https://img.shields.io/npm/dm/@brainhubeu/react-carousel?color=blue)](https://www.npmjs.com/package/@brainhubeu/react-carousel)\n  [![Activity](https://img.shields.io/github/commit-activity/m/brainhubeu/react-carousel.svg)](https://github.com/brainhubeu/react-carousel/commits/master)\n  [![Minified](https://img.shields.io/bundlephobia/min/@brainhubeu/react-carousel?label=minified)](https://www.npmjs.com/package/@brainhubeu/react-carousel)\n  [![npm](https://img.shields.io/npm/v/@brainhubeu/react-carousel.svg)](https://www.npmjs.com/package/@brainhubeu/react-carousel)\n  [![Contributors](https://img.shields.io/github/contributors/brainhubeu/react-carousel?color=blue)](https://github.com/brainhubeu/react-carousel/graphs/contributors)\n\u003c/div\u003e\n\n## Table of Contents\n- 🔌 [Installation](#installation)\n- 🐥 [Usage](#usage)\n- 🔨 [Props](#props)\n  - 🎠 [Carousel Props](#carousel-props)\n  - 🐾 [Dots Props](#dots-props)\n- 😻 [Contributing](#contributing)\n  - 💁 [Setting up local development](#setting-up-local-development-which-means-running-the-docsdemo-locally)\n  - 🐞 [Tests](#tests)\n  - 🏋️‍ [Workflow](#workflow)\n  - 🏷 [Labels](#labels)\n  - 📝 [Decision Log](#decision-log)\n\n## Why?\nThere are some great carousels (like slick) that do not have real React implementations. This library provides you with carousel that is not merely a wrapper for some jQuery solution, can be used as controlled or uncontrolled element (similar to [inputs](https://reactjs.org/docs/uncontrolled-components.html)), and has tons of useful features.\n\n## Installation\n### Basic\n```\nnpm i @brainhubeu/react-carousel\n```\n\n### Typescript\n```\nnpm i @types/brainhubeu__react-carousel -D\n```\n\n### SSR\nWhen using `@brainhubeu/react-carousel` with SSR (Server-side Rendering), we recommend [Next.js](https://github.com/zeit/next.js) as `@brainhubeu/react-carousel` currently doesn't work on the server side so it must be rendered on the client side (maybe we'll provide server-side working in the future).\n```js\nimport dynamic from 'next/dynamic';\n\nconst { default: Carousel, Dots } = dynamic(\n () =\u003e require('@brainhubeu/react-carousel'),\n { ssr: false },\n);\n```\n\n## Usage\nBy default, the component does not need anything except children to render a simple carousel.\nRemember that styles do not have to be imported every time you use carousel, you can do it once in an entry point of your bundle.\n```javascript\nimport React from 'react';\nimport Carousel from '@brainhubeu/react-carousel';\nimport '@brainhubeu/react-carousel/lib/style.css';\n\nconst MyCarousel = () =\u003e (\n  \u003cCarousel plugins={['arrows']}\u003e\n    \u003cimg src={imageOne} /\u003e\n    \u003cimg src={imageTwo} /\u003e\n    \u003cimg src={imageThree} /\u003e\n  \u003c/Carousel\u003e\n);\n\nexport default MyCarousel;\n```\n\n[![gif](readme/assets/carousel.gif)](https://brainhubeu.github.io/react-carousel/docs/examples/simpleUsage)\n\n### Showing dots or thumbnails\nThere is a separate Dots component that can be used to fully control navigation dots or add thumbnails.\n```javascript\nimport Carousel, { Dots } from '@brainhubeu/react-carousel';\nimport '@brainhubeu/react-carousel/lib/style.css'; import { useState } from 'react';\n\nconst MyCarouselWithDots = () =\u003e {\n  const [value, setValue] = useState(0);\n\n  const onChange = value =\u003e {\n  setValue(value);\n  }\n\n  return (\n    \u003cdiv\u003e\n      \u003cCarousel\n        value={value}\n        onChange={onChange}\n      \u003e\n        \u003cimg className=\"img-example\" src={someImage} /\u003e\n        ...\n        \u003cimg className=\"img-example\" src={anotherImage} /\u003e\n      \u003c/Carousel\u003e\n      \u003cDots\n        value={this.state.value}\n        onChange={this.onChange}\n        thumbnails={[\n          (\u003cimg key={1} className=\"img-example-small\" src={abstractImage} /\u003e),\n          ...\n          (\u003cimg key={12} className=\"img-example-small\" src={transportImage} /\u003e),\n        ]}\n      /\u003e\n    \u003c/div\u003e\n  );\n};\n\nexport default MyCarouselWithDots;\n```\n\n[![gif](readme/assets/thumbnails.gif)](https://brainhubeu.github.io/react-carousel/docs/examples/thumbnails)\n\n## Props\nYou can access a clickable demo with many examples and a [live code editor](https://brainhubeu.github.io/react-carousel/) by clicking on a Prop name.\n\n### Carousel props\n\n| Prop | Type | Default | Description |\n| --- | --- | --- | --- |\n| [**value**](https://brainhubeu.github.io/react-carousel/docs/examples/controlled) | *Number* | `undefined` | Current slide's index (zero based, depends on the elements order) |\n| [**onChange**](https://brainhubeu.github.io/react-carousel/docs/examples/controlled) | *Function* | `undefined` | Handler triggered when current slide is about to change (e.g. on arrow click or on swipe) |\n| **slides** | *Array* | `undefined` | Alternative way to pass slides. This prop expects an array of JSX \u003cimg\u003e elements |\n| **itemWidth** | *Number* | `undefined` | Determines custom width for every slide in the carousel |\n| **offset** | *Number* | `0` | Padding between items |\n| [**animationSpeed**](https://brainhubeu.github.io/react-carousel/docs/examples/animation) | *Number* | `500` | Determines transition duration in milliseconds |\n| [**draggable**](https://brainhubeu.github.io/react-carousel/docs/examples/draggable) | *Boolean* | `true` | Makes it possible to drag to the next slide with mouse cursor |\n| [**breakpoints**](https://brainhubeu.github.io/react-carousel/docs/examples/responsive) | *Object* | `undefined` | All props can be set to different values on different screen resolutions |\n\n### Plugins\nYou can extend react-carousel default behavior by applying plugins shipped within carousel\n\n[**Plugins documentation**](https://brainhubeu.github.io/react-carousel/docs/plugins/plugins)\n\n### Dots props\n\n| Prop | Type | Default | Description |\n| --- | --- | --- | --- |\n| [**value**](https://brainhubeu.github.io/react-carousel/docs/examples/dots) | *Number* | slide position in the slides Array | Current `Carousel` value |\n| [**onChange**](https://brainhubeu.github.io/react-carousel/docs/examples/dots) | *Function* | `undefined` | `onChange` callback (works the same way as `onChange` in `Carousel` component) |\n| [**number**](https://brainhubeu.github.io/react-carousel/docs/examples/dots) | *Number* | Amount of slides | Number of slides in the carousel you want to control |\n| [**thumbnails**](https://brainhubeu.github.io/react-carousel/docs/examples/thumbnails) | *Array of ReactElements* | `undefined` | Array of thumbnails to show. If not provided, default dots will be shown |\n| [**rtl**](https://brainhubeu.github.io/react-carousel/docs/examples/rtl) | *Boolean* | `false` | Indicating if the dots should have direction from Right to Left |\n\n### Setting up local development which means running the docs/demo locally:\n- `git clone https://github.com/brainhubeu/react-carousel`\n- `cd react-carousel`\n- `yarn`\n- `yarn start-demo`\n- open http://localhost:8000/\n\n### Tests\nEach test command should be run from the root directory.\n\n#### Unit tests\n```\nyarn test:unit:coverage\n```\n\n#### E2E tests\n```\nyarn test:e2e\n```\n\n### Workflow\nSee [the Workflow subsection in our docs](https://brainhubeu.github.io/react-carousel/docs/contributions-guide/workflow)\n\n### Labels\nSee [the Labels subsection in our docs](https://brainhubeu.github.io/react-carousel/docs/contributions-guide/labels)\n\n### Decision log\nSee [the Decision log subsection in our docs](https://brainhubeu.github.io/react-carousel/docs/contributions-guide/decision-log)\n\n## License\n\nreact-carousel is copyright © 2018-2020 [Brainhub](https://brainhub.eu/?utm_source=github). It is free software and may be redistributed under the terms specified in the [license](LICENSE.md).\n\n## About\n\nreact-carousel is maintained by the Brainhub development team. It is funded by Brainhub and the names and logos for Brainhub are trademarks of Brainhub Sp. z o.o.. You can check other open-source projects supported/developed by our teammates [here](https://github.com/brainhubeu). \n\n[![Brainhub](https://brainhub.eu/brainhub.svg)](https://brainhub.eu/?utm_source=github)\n\nWe love open-source JavaScript software! See our other projects or hire us to build your next web, desktop and mobile application with JavaScript.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainhubeu%2Freact-carousel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrainhubeu%2Freact-carousel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainhubeu%2Freact-carousel/lists"}