All Projects → maxmarinich → React Alice Carousel

maxmarinich / React Alice Carousel

Licence: mit
React responsive component for building content galleries, content rotators and any React carousels

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Alice Carousel

React Awesome Slider
React content transition slider. Awesome Slider is a 60fps, light weight, performant component that renders an animated set of production ready UI general purpose sliders with fullpage transition support for NextJS and GatsbyJS. 🖥️ 📱
Stars: ✭ 2,343 (+459.19%)
Mutual labels:  react-component, gallery, carousel, image-gallery
React Image Gallery
React carousel image gallery component with thumbnail support 🖼
Stars: ✭ 2,946 (+603.1%)
Mutual labels:  gallery, carousel, image-gallery, react-component
React Responsive Carousel
React.js Responsive Carousel (with Swipe)
Stars: ✭ 1,962 (+368.26%)
Mutual labels:  react-component, gallery, carousel
react-native-image-page
react-native image-carousel with zoom-pan gestures and full-screen support, work on both iOS and Android
Stars: ✭ 19 (-95.47%)
Mutual labels:  gallery, image-gallery, carousel
React Grid Carousel
React responsive carousel component w/ grid layout
Stars: ✭ 29 (-93.08%)
Mutual labels:  react-component, gallery, carousel
MediaSliderView
Pure java based, highly customizable media slider gallery supporting both images and videos for android.
Stars: ✭ 85 (-79.71%)
Mutual labels:  gallery, carousel
native-gallery
native image gallery in ~100 lines of code
Stars: ✭ 19 (-95.47%)
Mutual labels:  image-gallery, carousel
skeleton-carousel
Carousel component. Horizontal and vertical swipe navigation
Stars: ✭ 31 (-92.6%)
Mutual labels:  gallery, carousel
react-nft-gallery
🖼️ React component to display your NFTs as a gallery
Stars: ✭ 50 (-88.07%)
Mutual labels:  gallery, react-component
react-carousel-minimal
React.js Responsive Minimal Carousel
Stars: ✭ 76 (-81.86%)
Mutual labels:  react-component, carousel
Ngx Gallery
Angular Gallery, Carousel and Lightbox
Stars: ✭ 417 (-0.48%)
Mutual labels:  gallery, carousel
ngx-image-gallery
Probably the best Angular 4+ modal and inline image gallery. Angular upgrade for ng-image-gallery.
Stars: ✭ 80 (-80.91%)
Mutual labels:  gallery, carousel
React Touch Carousel
Ultra-customizable carousel framework for React.JS
Stars: ✭ 158 (-62.29%)
Mutual labels:  react-component, carousel
React Items Carousel
Items Carousel Built with react-motion and styled-components
Stars: ✭ 150 (-64.2%)
Mutual labels:  react-component, carousel
angular-super-gallery
AngularJS super image gallery
Stars: ✭ 46 (-89.02%)
Mutual labels:  gallery, image-gallery
Vue Gallery
📷 Responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.
Stars: ✭ 405 (-3.34%)
Mutual labels:  gallery, carousel
pigallery
PiGallery: AI-powered Self-hosted Secure Multi-user Image Gallery and Detailed Image analysis using Machine Learning, EXIF Parsing and Geo Tagging
Stars: ✭ 35 (-91.65%)
Mutual labels:  gallery, image-gallery
Angular2 Image Gallery
Image Gallery built with Angular 8+, node.js and GraphicsMagick
Stars: ✭ 288 (-31.26%)
Mutual labels:  gallery, image-gallery
React Splide
The Splide component for React.
Stars: ✭ 32 (-92.36%)
Mutual labels:  react-component, carousel
React Native Swipeable Parallax Carousel
React Native Swipeable Parallax Carousel
Stars: ✭ 98 (-76.61%)
Mutual labels:  react-component, carousel

React Alice Carousel

npm version Build Status

React Alice Carousel is a React component for building content galleries, content rotators and any React carousels.

👉  Live demo (API): v2.x.x

👉  Previous version (API): v1.x.x

demo gif

demo gif

Features

  • Auto Height
  • Auto Play
  • Auto Width
  • Custom animation modes
  • Custom rendered slides
  • Infinite loop
  • Lazy loading
  • Mobile friendly
  • Multiple items in the slide
  • Responsive design
  • Stage padding
  • Show / hide anything (indicators, arrows, slides indexes)
  • Swipe to slide
  • Server side rendering friendly
  • Touch and Drag support
  • TypeScript

Installation

npm i react-alice-carousel

Style import

# CSS
@import "react-alice-carousel/lib/alice-carousel.css";
# SCSS
@import "react-alice-carousel/lib/scss/alice-carousel.scss";

Usage

import React from 'react';
import AliceCarousel from 'react-alice-carousel';
import 'react-alice-carousel/lib/alice-carousel.css';

const handleDragStart = (e) => e.preventDefault();

const items = [
  <img src="path-to-img" onDragStart={handleDragStart} />,
  <img src="path-to-img" onDragStart={handleDragStart} />,
  <img src="path-to-img" onDragStart={handleDragStart} />,
];

const Gallery = () => {
  return (
    <AliceCarousel mouseTracking items={items} />
  );
}

Options

  • activeIndex : Number, default 0 - Set carousel at the specified position.

  • animationDuration: Number, default 400 - Set duration of animation.

  • animationEasingFunction: String or Function, default ease - Property sets how an animation progresses through the duration of each cycle.

  • animationType: String(slide, fadeout), default slide - Set type of animation.

  • autoHeight: Boolean, default false - Set auto height mode.

  • autoWidth: Boolean, default false - Set auto width mode.

  • autoPlay: Boolean, default false - Set autoplay mode.

  • autoPlayControls: Boolean, default false - Show/hide play/pause buttons.

  • autoPlayDirection: String(ltr, rtl), default ltr - Set autoplay direction value.

  • autoPlayInterval: Number, default 400 - Set autoplay interval value.

  • autoPlayStrategy: String(default, action, all, none) - Set a strategy for autoplay mode

    • default - pause automatic playback on the hover
    • action - stop automatic playback if user action was detected
    • all - merge default && action strategies
    • none - ignore any user actions when the autoPlay property was specified
  • controlsStrategy: String (default, responsive) - Set a strategy for gallery controls. Dots navigation will be hidden if responsive property is set and the number of gallery elements is equal to the number of items in the slide.

  • disableButtonsControls: Boolean, default false - Disable buttons controls.

  • disableDotsControls: Boolean, default false - Disable dots controls.

  • disableSlideInfo: Boolean, default true - Disable information about current slide.

  • infinite: Boolean, default false - Set infinite mode.

  • innerWidth: Number, default 0 - Set a static value for a breakpoint(key) of the "responsive" property. For example, if you can't use 'window.innerWidth' during SSR.

  • items: Array, default undefined - Set gallery items, preferable to use this property instead of children.

  • mouseTracking: Boolean, default false - Enable mouse drag animation.

  • paddingLeft: Number, default 0 - Set the gallery offset from the left.

  • paddingRight: Number, default 0 - Set the gallery offset from the right.

  • renderKey: Number, default undefined - Auxiliary property, allows call the render method without changing the state inside the gallery instance.

  • responsive: Object, default undefined - Set number of items in the slide. The key is the breakpoint (default is the result of: () => window.innerWidth or innerWidth property if the last presented).

        {
          0: {
              items: 1,
          },
          1024: {
              items: 3
          }
        }
    
  • swipeDelta: Number, default 20 - Set minimum distance to the start of the swiping (px).

  • swipeExtraPadding: Number, default 200 - Set maximum distance from initial place before swipe action will be stopped (px).

  • touchTracking: Boolean, default true - Enable touch move animation.

  • touchMoveDefaultEvents: Boolean, default true - Enable touch move default events on swiping. If false was specified, this prevents vertical scrolling of the parent elements during the swipe.

  • onInitialized(e: EventObject): Function - Fired as callback after the gallery was created.

  • onResizeEvent(e: Event): Function - Fired during the "resize" event to determine whether to call the event handler. Default result of () => true;

  • onResized(e: EventObject): Function - Fired as callback after the gallery was resized.

  • onSlideChange(e: EventObject): Function - Fired before the event object changes.

  • onSlideChanged(e: EventObject): Function - Fired after the event object was changed.

  • renderSlideInfo(e: SlideInfo): Rendering function - create a custom component.

  • renderDotsItem(e: DotsItem): Rendering function - create a custom component.

  • renderPrevButton({ isDisabled }): Rendering function - create a custom component.

  • renderNextButton({ isDisabled }): Rendering function - create a custom component.

  • renderPlayPauseButton({ isPlaying }): Rendering function - create a custom component.

Methods

  • slidePrev(e: Event) => void : Go to the prev slide.
  • slideNext(e: Event) => void : Go to the next slide.
  • slideTo(activeIndex?: number) => void : Go to the specified slide.

Types

type EventObject = {
  item: number;
  slide: number;
  itemsInSlide: number;
  isPrevSlideDisabled: boolean;
  isNextSlideDisabled: boolean;
  type: EventType;
};

type SlideInfo = {
  item: number;
  itemsCount: number;
};

type DotsItem = {
  isActive: boolean;
  activeIndex: number;
};

enum EventType {
  ACTION = 'action', // used if a general user action (button click or swipe)
  INIT = 'init',     // used if the initial event was triggered
  RESIZE = 'resize', // used if the gallery size was changed
  UPDATE = 'update', // used if the gallery was updated with props (activeIndex)
}

CSS classes

.alice-carousel

.alice-carousel__stage
.alice-carousel__stage-item

.alice-carousel__prev-btn
.alice-carousel__prev-btn-item

.alice-carousel__next-btn
.alice-carousel__next-btn-item

.alice-carousel__play-btn
.alice-carousel__play-btn-item

.alice-carousel__dots
.alice-carousel__dots-item

.alice-carousel__slide-info
.alice-carousel__slide-info-item

CSS modifiers

.alice-carousel.__ssr

.alice-carousel__stage-item.__active
.alice-carousel__stage-item.__cloned
.alice-carousel__stage-item.__target

.alice-carousel__next-btn-item.__inactive
.alice-carousel__prev-btn-item.__inactive

.alice-carousel__play-btn-item.__pause

.alice-carousel__dots-item.__active
.alice-carousel__dots-item.__custom

.alice-carousel__slide-info-item.__separator

Build the project locally

Clone

git clone https://github.com/maxmarinich/react-alice-carousel
cd react-alice-carousel

Run

npm i
npm start

Test

npm test

License

MIT

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].