npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pure-react-carousel-thumbs

v1.0.6

Published

A simple carousel with no other dependencies with thumbnails. A simple, customizable carousel component for React applications. A customizable React carousel component with support for thumbnails, autoplay, swiping, and more.

Downloads

57

Readme

pure-react-carousel-thumbs

A simple carousel with no other dependencies with thumbnails. A simple, customizable carousel component for React applications. A customizable React carousel component with support for thumbnails, autoplay, swiping, and more.

Installation

npm install pure-react-carousel-thumbs

Usage

First, import the Carousel and CarouselThumbs components:

import { Carousel, CarouselThumbs } from 'pure-react-carousel-thumbs';

function App() {
  const images = [
    'https://your-image-url-1.jpg',
    'https://your-image-url-2.jpg',
    'https://your-image-url-3.jpg',
  ];

  const [currentIndex, setCurrentIndex] = useState(0);

  return (
    <>
      <Carousel images={images} onChange={setCurrentIndex} />
      <CarouselThumbs
        images={images}
        currentIndex={currentIndex}
        changeIndex={setCurrentIndex}
      />
    </>
  );
}

Carousel Component

The Carousel component displays a carousel of images with customizable options.

Props

|Prop|Type|Default|Description| |---|---|---|---| |images |string[]|undefined|undefined An array of image URLs to display in the carousel. |className|string|undefined|undefined Optional CSS class for the carousel container. |changeOnClick|boolean|true|Whether to change the slide when clicking on it. |cover|boolean|false|Whether to cover the entire carousel container otherwise background should scale with height set to auto. |index|number|0|The initial index of the carousel. |height|number|string|'auto'|The height of the carousel container. |width|number|string|'100%'|The width of the carousel container. |interval|number|0|The interval for autoplay (in milliseconds). Set to 0 to disable autoplay. |animationDuration|number|500|The duration of the slide change animation (in milliseconds). |autoPlay|boolean|false|Whether to enable autoplay. |stopAutoPlayOnHover|boolean|false|Whether to stop autoplay when hovering over the carousel. |swipe|boolean|true|Whether to enable swipe gestures. |navButtonsAlwaysVisible|boolean|false|Whether to always show navigation buttons. |navButtonsAlwaysInvisible|boolean|false|Whether to never show navigation buttons.

CarouselThumbs Component

The CarouselThumbs component displays a row of thumbnail images that can be clicked to change the current slide in the main carousel.

Props

|Prop|Type|Default|Description| |---|---|---|---| |images|string[] | undefined|undefined|An array of image URLs to display as thumbnails. |currentIndex|number|0|The index of the currently displayed image in the main carousel. |changeIndex|(newIndex: number) => void|undefined|A function that changes the index of the currently displayed image in the main carousel. |height|number | string|'250px'|The height of the thumbnail images. |width|number | string|'250px'|The width of the thumbnail images. |thumbsClassName|string|undefined|Optional CSS class for the thumbnail images. |containerClassName|string|undefined|Optional CSS class for the thumbnails container. |thumbStyle|React.CSSProperties|undefined|Optional style object for the thumbnail images. |containerStyle|React.CSSProperties|undefined|Optional style object for the thumbnails container.