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

react-slideshow-with-pagination

v1.0.2

Published

This is a fully responsive slideshow that can have pagination (numbers or dots) and arrows for changing screens.

Downloads

42

Readme

React Slideshow with Pagination

You can check out the live-slideshow.vercel.app demo (from Live Slideshow repository) that was created to show this library's potentials in action.

Slideshow Screenshots

The react-slideshow-with-pagination can have pagination (numbers or dots) and arrow buttons for changing screens and dozens of other feature that help to customize the slideshow as much as possible. Also, check out the demo from a mobile device (real or emulated) it's fully responsive.

Installation:

npm install --save react-slideshow-with-pagination

How to use:

Import the SlideshowWithPagination from react-slideshow-with-pagination and just like that you have a fully responsive slideshow with pagination and arrow buttons.

Note that you can use the library with the pagination and arrow buttons feature (only) or you can use it with the pagination and arrow buttons along with the preset card features which have almost anything you expect from the slideshow. For example, you can have one card (item) or multiple cards (items) in one screen of the slideshow, and if the width of the screen decreases it will change them to one card per screen. You can control when this happens by passing one of the breakpoint values ('xs', 'sm', 'md', 'lg' or 'xl') to the showOneCardForWidthLower property. And dozens of features that can be found here.

import React from "react";
import SlideshowWithPagination from "react-slideshow-with-pagination";

import Image1 from "../assets/images/image-1.jpg";
import Image2 from "../assets/images/image-2.jpg";
import Image3 from "../assets/images/image-3.jpg";
import Image4 from "../assets/images/image-4.jpg";

const CARDS_DETAILS = [
  { image: Image1, title: "1" },
  { image: Image2, title: "2" },
  { image: Image3, title: "3" },
  { image: Image4, title: "4" },
]

const Slideshow = () => {
  return (
    // Slideshow with preset card features along with pagination and arrow buttons
    <SlideshowWithPagination
      options={CARDS_DETAILS}
      showNumbers={true}
      showDots={true}
      showArrows={true}
      numberOfCardsPerScreen={3}
      showOneCardForWidthLower="sm"
      slideshowContainerMaxWidth={false}
      cardWidth={500}
      cardHeight={300}
    />
    // Slideshow with (only) pagination and arrow buttons feature
    <SlideshowWithPagination
      showNumbers={true}
      showDots={true}
      showArrows={true}
    >
      {CARDS_DETAILS.map((item, index) => (
        <React.Fragment key={index}>
          <img src={item.image} alt={item.title} />
          <p>{item.title}</p>
        </React.Fragment>
      ))}
    </SlideshowWithPagination>
  );
};

export default Slideshow

Note: Use option property only when you want to have access to the built-in card feature otherwise only pass items as children to slideshow (which in this case you only have pagination and arrows buttons).

The API documentation:

The react-slideshow-with-pagination API:

Important Note: You have to choose between passing your array (or items) as children to the slideshow (which provides only pagination and arrow buttons feature) or passing your array to the options property (which then in addition to the pagination and arrow buttons, you also have access to provided cards with dozens of features) because some properties only work when an array is passed to the options property. But keep it in mind that you must pass the array to the options property only with this accepted format: [{ image: "imageAddrress", title: "cardTitle" }, ...].

| Name | Type | Default | When does this property work? | Description | | -------------------------- | -------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | children | node | - | - | Use this property to provide your slides (with this property only pagination and arrow buttons are available). | | options | array | Accepted format: [{image: "imageAddrress", title: "cardTitle"}, ...] | - | Use this property to provide your slides (with this property in addition to pagination and arrow buttons, provided card features are available too). | | showNumbers | bool | false | With both children and options property | If true, the number pagination will be shown under the slideshow. | | showDots | bool | false | With both children and options property | If true, the dot pagination will be shown under the slideshow. | | showArrows | bool | false | With both children and options property | If true, two arrow buttons for changing the screen will be shown on the left and right of the slideshow screen. | | autoplay | bool | true | With both children and options property | If false, the autoplay behavior will be disabled. | | enableMouseEvents | bool | true | With both children and options property | If false, it will disable mouse events. The enableMouseEvents property will allow the user to perform the relevant swipe actions with a mouse. | | numberOfCardsPerScreen | number | 3 | Only with options property | It shows the number of cards per each screen (only for width upper than what is set with the showOneCardForWidthLower property). | | showOneCardForWidthLower | string | 'xs', 'sm', 'md', 'lg', 'xl' | Only with options property | For width lower than this, it shows only one card per screen. | | slideshowContainerMaxWidth | string | false, 'xs', 'sm', 'md', 'lg', 'xl' | Only with options property | Defines the maximum width of the entire slideshow screen. | | cardsContainerJustify | string | 'space-around' | Only with options property | Control the distributes space between and around cards (for more than one card per screen) along the main axis. | | cardWidth | number | 390 | Only with options property | Defines the width of each card. | | cardHeight | number | 245 | Only with options property | Defines the height of each card | | cardMarginX | number | 0 | Only with options property | Defines the horizontal margin between cards. | | cardMarginY | number | 0 | Only with options property | Defines the vertical margin between cards. | | textColor | string | 'rgba(0, 0, 0, 0.87)' | Only with options property | Determine the color of the number pagination and the cards title. | | lightColorBtn | string | '#bdbdbd' | Only with options property | Determine the color of the dots and arrow buttons. | | darkColorBtn | string | '#616161' | Only with options property | Determine the color of the dots and arrow buttons when selected or hovered. | | paginationMarginTop | number | 3 | Only with options property | Defines the top margin between the pagination (number or dot) and the cards. | | interval | number | 5000 | With both children and options property | Delay between autoplay transitions (in ms). | | springConfig | object | {duration: '1s', easeFunction: 'ease-in-out', delay: '0s'} | With both children and options property | This is the config used to create CSS transitions. This is useful to change the dynamic of the transition. | | direction | 'incremental', 'decremental' | 'incremental' | With both children and options property | This is the autoplay direction. |

The react-swipeable-views API:

I used react-swipeable-views library for this project. So its properties can be passed to the react-slideshow-with-pagination as well. You can find out the full API documentation list of react-swipeable-views here.

License:

This project is licensed under the terms of the MIT license.