Gathering detailed insights and metrics for react-alice-carousel
Gathering detailed insights and metrics for react-alice-carousel
Gathering detailed insights and metrics for react-alice-carousel
Gathering detailed insights and metrics for react-alice-carousel
react-keshan-carousel
React image gallery, react slideshow carousel, react content rotator. It is actually `react-alice-carousel` with several patches
@ant-design/react-slick
React port of slick carousel
embla-carousel-react
A lightweight carousel library with fluid motion and great swipe precision
react-slick
React port of slick carousel
npm install react-alice-carousel
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
843 Stars
364 Commits
92 Forks
9 Watching
17 Branches
10 Contributors
Updated on 08 Nov 2024
Minified
Minified + Gzipped
TypeScript (84.7%)
SCSS (9.08%)
JavaScript (5.45%)
HTML (0.76%)
Cumulative downloads
Total Downloads
Last day
-11.3%
7,952
Compared to previous day
Last week
-6.6%
42,194
Compared to previous week
Last month
13.4%
187,284
Compared to previous month
Last year
11%
2,046,352
Compared to previous year
1
1
54
React Alice Carousel is a React component for building content galleries, content rotators and any React carousels.
1npm i react-alice-carousel
# CSS
@import "react-alice-carousel/lib/alice-carousel.css";
# SCSS
@import "react-alice-carousel/lib/scss/alice-carousel.scss";
1import React from 'react'; 2import AliceCarousel from 'react-alice-carousel'; 3import 'react-alice-carousel/lib/alice-carousel.css'; 4 5const handleDragStart = (e) => e.preventDefault(); 6 7const items = [ 8 <img src="path-to-img" onDragStart={handleDragStart} role="presentation" />, 9 <img src="path-to-img" onDragStart={handleDragStart} role="presentation" />, 10 <img src="path-to-img" onDragStart={handleDragStart} role="presentation" />, 11]; 12 13const Gallery = () => <AliceCarousel mouseTracking items={items} />;
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 hoveraction
- stop automatic playback if user action was detectedall
- merge default
&& action
strategiesnone
- ignore any user actions when the autoPlay
property was specifiedcontrolsStrategy
: String (default
, responsive
, alternate
or combined string "default,alternate"
) - Set a strategy for gallery controls.
default
- use controls as isalternate
- show each dot for each slideresponsive
- navigation will be hidden if 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.
keyboardNavigation
: Boolean, default false
- Enable keyboard navigation
ArrowLeft
- go to the prev slideArrowRight
- go to the next slideSpace
- run/stop autoplay mode if autoPlay
property is equal true
mouseTracking
: Boolean, default false
- Enable mouse drag animation. Consider the problem with links, see the example of using the <Link/>
component below.
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
- The key is the breakpoint (default is the result of: () => window.innerWidth or innerWidth
property if the last presented).
items
- set number of items in the slide. Default: 1
itemsFit
: one of (contain | fill | undefined
) - defines, how item should fill the container according slide's width. Default: fill
.
If contain
is specified, the gallery will use the value from the items
property to determine the width of the element for each slide and fill in the empty space as needed.
1 { 2 0: { 3 items: 1, 4 }, 5 1024: { 6 items: 3, 7 itemsFit: 'contain', 8 } 9 }
syncStateOnPropsUpdate
: Boolean, default true
- Sync some props (like activeIndex
) with carousel state while new props passed. This allows you to avoid resetting the carousel position while updating the props (e.g.: children
or items
).
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).
ssrSilentMode
: Boolean, default true
- Disable classnames modifiers for server side rendering.
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, default shouldProcessResizeEvent
method - Fired during the "resize" event to determine whether to call the event handler. Default method checks is the root element width has changed.
onResized(e: EventObject)
: Function - Fired as callback after the gallery was resized.
onUpdated(e: EventObject)
: Function - Fired as callback after updating the gallery props.
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.
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.<Link />
: allows properly handle click and drag events when mouseTracking enabled, extends base HTMLAnchorElement1import React from 'react'; 2import AliceCarousel, { Link } from 'react-alice-carousel'; 3import 'react-alice-carousel/lib/alice-carousel.css'; 4 5const Gallery = () => { 6 return ( 7 <AliceCarousel mouseTracking> 8 <Link href="#"> 9 <img src="path-to-image" /> 10 </Link> 11 </AliceCarousel> 12 ); 13};
1type EventObject = { 2 item: number; 3 slide: number; 4 itemsInSlide: number; 5 isPrevSlideDisabled: boolean; 6 isNextSlideDisabled: boolean; 7 type: EventType; 8}; 9 10type SlideInfo = { 11 item: number; 12 itemsCount: number; 13}; 14 15type DotsItem = { 16 isActive: boolean; 17 activeIndex: number; 18}; 19 20enum EventType { 21 ACTION = 'action', // used if a general user action (button click or swipe) 22 INIT = 'init', // used if the initial event was triggered 23 RESIZE = 'resize', // used if the gallery size was changed 24 UPDATE = 'update', // used if the gallery was updated with props 25}
1.alice-carousel 2 .alice-carousel__stage 3 .alice-carousel__stage-item 4 .alice-carousel__prev-btn 5 .alice-carousel__prev-btn-item 6 .alice-carousel__next-btn 7 .alice-carousel__next-btn-item 8 .alice-carousel__play-btn 9 .alice-carousel__play-btn-item 10 .alice-carousel__dots 11 .alice-carousel__dots-item 12 .alice-carousel__slide-info 13 .alice-carousel__slide-info-item;
1.alice-carousel.__ssr 2 .alice-carousel__stage-item.__active 3 .alice-carousel__stage-item.__cloned 4 .alice-carousel__stage-item.__target 5 .alice-carousel__next-btn-item.__inactive 6 .alice-carousel__prev-btn-item.__inactive 7 .alice-carousel__play-btn-item.__pause 8 .alice-carousel__dots-item.__active 9 .alice-carousel__dots-item.__custom 10 .alice-carousel__slide-info-item.__separator;
1git clone https://github.com/maxmarinich/react-alice-carousel 2cd react-alice-carousel
1npm ci 2npm start
1npm test
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
Found 1/12 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
22 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More