1.4.3 • Published 17 days ago

react-responsive-3d-carousel v1.4.3

Weekly downloads
-
License
MIT
Repository
github
Last release
17 days ago

License: MIT

The React Responsive 3D Carousel is a versatile component designed for React applications. It offers a responsive user interface that adapts seamlessly to different screen widths. Notably, it also includes support for recognizing swipe gestures on mobile devices.

Getting started with this package is straightforward. Explore the documentation for installation and usage instructions.

Demo Page & Links

Key Features

  • Source map-excluded JavaScript file size is 12KB.
  • Experience a responsive design that adapts to various screen sizes.
  • Enable swipe gesture recognition to enhance mobile usability.
  • Supports TypeScript and CommonJS.

Installation

Install the package with the following command. React18 should be pre-installed.

npm install react-responsive-3d-carousel

Usage

You can pass down any \ you want

import React from 'react'
import { Carousel } from 'react-responsive-3d-carousel'

export default App() {
  return (
    <Carousel>
      <img src="https://example-image-url-1" alt="example-image-1" />
      <img src="https://example-image-url-2" alt="example-image-2" />
      <video src="https://example-video-url" muted autoPlay loop />
      <iframe src="https://www.youtube.com/embed/example" title="YouTube video player" frameborder="0"/>
      <div>
        <p>Hello</p>
      </div>
    </Carousel>
  )
}

If the tag you want to display on the screen does not go down directly, you must add the following styling.

import React from 'react'
import { Carousel } from 'react-responsive-3d-carousel'

export default App() {
  return (
    <Carousel>
      <a href="https://unsplash.com/">
        <img
          src="https://source.unsplash.com/random/?dog"
          alt="sample-image"
          style={{
            width: '100%',
            height: '100%',
            objectFit: 'cover',
          }}
        />
      </a>
    </Carousel>
  )
}

Props

NameTypeDefaultDescription
widthstring'500px'Width of each carousel item (Accepts all CSS units)
heightstring'300px'Height of each carousel item (Accepts all CSS units)
spread'wide', 'normal', 'narrow''wide'Adjusts the horizontal spacing between carousel items.
depthnumber13D depth of the carousel
autoPlaybooleantrueAutomatically play slide animation
intervalnumber3000Slide transition time interval (ms)
transitionTimenumber500Slide transition animation time (ms)
infiniteLoopbooleantrueEnable slide animation infinitely
startIndexnumber0Index of the first carousel item to be centered
pauseOnHoverbooleantrueStop slide animation when user hovers over carousel
selectablebooleantrueClicking a carousel item positions it to the center
onClickCenteredItem(index: number) => voidundefinedEvent fired when centered item is clicked
isShadowbooleantrueDisplay shadows of carousel items
showStatusbooleantrueDisplay top right status text (e.g., 2/5)
statusSize'small', 'medium', 'large''small'Size of the status text
statusColorstring'rgb(255, 255, 255)'Color of the status text
isStatusShadowbooleantrueDisplay shadows for the status text
showArrowsbooleantrueDisplay arrow buttons at both ends
arrowsWidthstring'48px'Width of each arrow (Accepts all CSS units)
arrowsHeightstring'83px'Height of each arrow (Accepts all CSS units)
arrowsDefaultColorstring'rgb(255, 255, 255)'Color of arrows when not hovered
arrowsHoveredColorstring'rgba(34, 34, 34, 0.53)'Color of arrows when hovered
arrowsStrokeWidthnumber5The stroke width of arrows path
isArrowsShadowbooleantrueDisplay shadows for arrows
showIndicatorsbooleantrueDisplay bottom indicators
indicatorsSize'small', 'medium', 'large''small'Size of the indicators
indicatorsActiveColorstring'rgb(255, 255, 255)'Color of an activated indicator
indicatorsInactiveColorstring'rgba(67, 67, 67, 0.4)'Color of inactivated indicators
isIndicatorsShadowbooleantrueDisplay shadows for the indicators

Customizing

If necessary, you can override the CSS with !important. The class name can be found in the browser's developer tools or source code.

.react-responsive-3d-carousel__indicators li {
  width: 36px !important;
  height: 36px !important;
}

Contributing

Since this is my first npm package. Welcome to conributing.
Here's contributing guide that contains details on how to set up a development environment.

Issues

If you encounter an issue, please don't hesitate to let me know. Provide a detailed explanation along with any relevant images, and I'll do my best to make improvements. Github Issues

1.4.3

17 days ago

1.4.2

3 months ago

1.4.1

4 months ago

1.4.0

4 months ago

1.3.1

4 months ago

1.3.0

7 months ago

1.2.0

7 months ago

1.1.0

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago