1.1.1 • Published 2 years ago

@jdthornton/carousel v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@jdthornton/carousel

npm (scoped) npm bundle size (minified)

React carousel context and components.

Demo

https://jdthornton.github.io/#/carousel

Install

$ npm install @jdthornton/carousel

Usage

import Carousel from "@jdthornton/carousel";
import '@jdthornton/carousel/styles.css';

function App(){
  return(
    <Carousel
      visibleCount={2}
      step={2}
      scrollbarHide>
      <div>Slide 1</div>
      <div>Slide 2</div>
      <div>Slide 3</div>
      <div>Slide 4</div>
      <div>Slide 5</div>
    </Carousel>
  )
}

Props

PropTypeDescription
visibleCountnumberThe number of slides visible
stepnumberThe number of slides between each step
infinitebooleanEnables the Carousel to start over when out of steps
scrollablebooleanEnables scrolling
autoPlaybooleanEnables the Carousel to automatically take steps based on the interval prop.
intervalnumber (in milliseconds)The time in milliseconds it takes Carousel to automatically take a step.
disableControlsbooleanDisables all controls
disableKeyboardbooleanDisables keyboard controls
overlayControlsbooleanEnables control UI overlay
autoFocusbooleanThe Carousel will be focused on mount
showOnFocusbooleanShows control UI when Carousel is focused
controlOnFocusbooleanAllows controls when Carousel is focused
stopOnFocusbooleanPauses autoplay when Carousel is focused
darkbooleanSwitches to dark mode
isVerticalbooleanSwitches Carousel to vertical axis
dotsOverlaybooleanEnables dots UI overlay
dotsIsVerticalbooleanSwitches dots UI to vertical axis
dotsDarkbooleanSwitches dots UI to dark mode
dotsShowOnFocusbooleanOnly show dots UI when Carousel is focused
dotsHidebooleanHides dots UI
arrowsOverlaybooleanEnables arrows UI overlay
arrowsIsVerticalbooleanSwitches arrows UI to vertical axis
arrowsDarkbooleanSwitches arrows UI to dark mode
arrowsShowOnFocusbooleanOnly show arrows UI when Carousel is focused
arrowsHidebooleanHides arrows UI
scrollbarOverlaybooleanEnables scrollbar UI overlay
scrollbarIsVerticalbooleanSwitches scrollbar UI to vertical axis
scrollbarDarkbooleanSwitches scrollbar UI to dark mode
scrollbarShowOnFocusbooleanOnly show scrollbar UI when Carousel is focused
scrollbarHidebooleanHides scrollbar UI
sliderIsVerticalbooleanSwitches slider and slides to vertical axis
classNamestringCustom class to be added to Carousel wrapper element
classNames{ container, slider, nextArrow, prevArrow, dot, activeDot }Custom classes to be used with the Carousel. Classes passed via the classNames prop are added to the defaults
styleobjectCustom style to be added to the Carousel wrapper element
styles{ container, slider, nextArrow, prevArrow, dot, activeDot }Custom styles to be used with the Carousel. Styles passed via the styles prop are added to the defaults
renderNextArrow({ onClick: () => void, hasNext: boolean }) => React.ReactNodeRender custom next button. Receives an onClick function, which moves the slider forward one step, and a hasNext boolean which is true if there is another step available.
renderPrevArrow({ onClick: () => void, hasPrev: boolean }) => React.ReactNodeRender custom previous button. Receives an onClick function, which moves the slider backwards one step, and a hasPrev boolean which is true if there is another step available.
renderDot({ onClick: () => void, step: number, isActive: boolean }) => React.ReactNodeRender custom dot. Receives an onClick function, which moves the slider to the step the dot indicates, a step number, representing the step index of the dot, and an isActive boolean, if the dot's step index matches the Carousel's active step index.
1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago