A lightweight React carousel supporting multiple visible slides
npm install react-fancysliderbash
npm install react-fancyslider
`
Note: You are to use this library along with react.js >= 18, since it is a pure react component under the hood.
Usage
Import the Slider component in your desired react component using following code:
`javascript
import { Slider } from "react-fancyslider";
`
Then, simply use it with below code.
`javascript
const images = [imgUrl1, imgUrl2, imgUrl3] //Slider Images
customCss='customClass'
slideToShow={3}
images = {images}
auto={true}
timer={2000}
transitionTime = {500}
directionNav = {true}
dotNav={true}
animation='fancy'
aspectRatio='3/4'
gap={20}
/>
`
Props || Options
Below are the options to control Slider component as per requirement:
slideToShow {type: number}: number of slides to show. Max is 3. Default: 1
customCss {type: string}: custom class name passed to slider for better control
images {type:[string]}: image links/urls for slider *Required
auto {type: boolean}: sets slider to auto slide Default: true
timer {type: number}: sets the speed of the slideshow cycling, in milliseconds Default: 4000 || 4s
transitionTime {type: number}: sets the speed of animation, in milliseconds Default" 500 || 0.5s
directionNav {type: boolean}: enable / disable left and right arrow for navigation Default: false
dotNav {type: boolean}: enable / disable dot navigation Default: false
animation {type:enum [fancy | slide | fade]} : sets easing of animation. You can have choose between default (fancy), fade or simple slide easing Default: fancy
aspectRatio {type: string}: sets aspect ratio for slides (e.g. "16/9", "4/3", "1/1") Default: "3/4"
gap {type: number}: sets spacing between slides in pixels Default: 0`