All Projects → gajus → React Carousel

gajus / React Carousel

Licence: other
React carousel component.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Carousel

React Alice Carousel
React responsive component for building content galleries, content rotators and any React carousels
Stars: ✭ 419 (+2518.75%)
Mutual labels:  carousel
Simple Slider
🎠 The 1kb JavaScript Carousel
Stars: ✭ 583 (+3543.75%)
Mutual labels:  carousel
Swiper
Most modern mobile touch slider with hardware accelerated transitions
Stars: ✭ 29,519 (+184393.75%)
Mutual labels:  carousel
Vue Slick Carousel
🚥Vue Slick Carousel with True SSR Written for ⚡Faster Luxstay
Stars: ✭ 447 (+2693.75%)
Mutual labels:  carousel
Hooper
🎠 A customizable accessible carousel slider optimized for Vue
Stars: ✭ 561 (+3406.25%)
Mutual labels:  carousel
Css Components
☕️ A set of common UI Components using the power of CSS and without Javascript.
Stars: ✭ 592 (+3600%)
Mutual labels:  carousel
Vue Gallery
📷 Responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.
Stars: ✭ 405 (+2431.25%)
Mutual labels:  carousel
Splide
Splide is a lightweight, powerful and flexible slider and carousel, written in pure JavaScript without any dependencies.
Stars: ✭ 786 (+4812.5%)
Mutual labels:  carousel
Changedetection
Automatically track websites changes on Android in background.
Stars: ✭ 563 (+3418.75%)
Mutual labels:  carousel
Motionlayoutcarousel
Simple Carousel built with Android MotionLayout
Stars: ✭ 686 (+4187.5%)
Mutual labels:  carousel
Jt3dscrollview
ScrollView with custom effects during the scroll for iOS
Stars: ✭ 494 (+2987.5%)
Mutual labels:  carousel
React Multi Carousel
A lightweight production-ready Carousel that rocks supports multiple items and server-side rendering with no dependency. Bundle size 2kb.
Stars: ✭ 544 (+3300%)
Mutual labels:  carousel
Ngx Bootstrap
Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
Stars: ✭ 5,343 (+33293.75%)
Mutual labels:  carousel
Hjcarouseldemo
Stars: ✭ 437 (+2631.25%)
Mutual labels:  carousel
Glide
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
Stars: ✭ 6,256 (+39000%)
Mutual labels:  carousel
Ngx Gallery
Angular Gallery, Carousel and Lightbox
Stars: ✭ 417 (+2506.25%)
Mutual labels:  carousel
Cardview
CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
Stars: ✭ 587 (+3568.75%)
Mutual labels:  carousel
Newpagedflowview
电影票卡片式无限自动轮播图
Stars: ✭ 819 (+5018.75%)
Mutual labels:  carousel
React Carousel
A pure extendable React carousel, powered by Brainhub (craftsmen who ❤️ JS)
Stars: ✭ 764 (+4675%)
Mutual labels:  carousel
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+34481.25%)
Mutual labels:  carousel

react-carousel

Travis build status NPM version Canonical Code Style Twitter Follow

A carousel.

Markup

.react-carousel
  .react-carousel__navigation-button .react-carousel__navigation-button--previous
  ul
    li
  .react-carousel__navigation-button .react-carousel__navigation-button--next

Usage

Refer to demo for a complete setup.

<Carousel
  controlWidth={50}
  itemWidth={240}
  itemMargin={20}
>
  <div>foo</div>
  <div>bar</div>
  <div>baz</div>
</Carousel>

Demo

git clone https://github.com/gajus/react-carousel.git
cd ./react-carousel/demo
npm install
npm start

Behaviour

  • The component does very little by itself. You provide it the input with props, and it renders it. To make any changes (like change active item, scroll items), you need to change props that you pass to it

    Ideally, you keep state in a (redux) store, and pass that state as props to this component. The callbacks are used to manipulate the store which shall eventually change the props passed, and render the component.

  • The component will show scroll buttons (two buttons; one in front of the carousel and one at the end) if number of items in the carousel exceed the total number of items that can be displayed without overflowing the contents.

  • The total number of items that can be displayed in the carousel is determined using the width of the component container, the itemWidth property value and itemMargin property value.

  • The carousel shrinks if the container width can't be filled with items.

  • onItemActivate will be given the key of the item that is clicked by the user.

  • onItemScroll gets called when user clicks on next/ previous scroll button. It gives index of the new firstVisibleIndex item.

Properties

/**
 * Called when user clicks on an item.
 *
 * @typedef Carousel~onItemActivate
 * @property {String} Key prop of the item
 */

/**
 * Called when user clicks on buttons to scroll items (next or previous)
 *
 * @typedef Carousel~onItemScroll
 * @property {Number} index Index to scroll to
 */

/**
 * @property {Carousel~controlWidth} Width of the carousel navigation button.
 * @property {Carousel~firstVisibleIndex} Index to which the carousel is scrolled to (i.e the first index which is visible.) (default: `0`).
 * @property {Carousel~itemMargin} Margin between two items in the carousel.
 * @property {Carousel~itemWidth} Width of an item.
 * @property {Carousel~onItemActivate} Called when user clicks on an item.
 * @property {Carousel~onItemScroll} Called when user clicks on control buttons.
 * @property {Carousel~scrollStepDistance} Number of items to scroll at one time (default: the current visible item count).
 */
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].