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-rapid-carousel

v2.0.1

Published

A simple but epic React Responsive Carousel.

Downloads

27

Readme

react-rapid-carousel

A simple but epic React Responsive Carousel.

NPM JavaScript Style Guide

Install

npm install --save react-rapid-carousel

USAGE

clone and test our github repo https://github.com/chineduogada/react-rapid-carousel, and cd ./example/src/Demos for more examples

import React, { useState } from 'react'

import { Slider, Fader } from 'react-rapid-carousel'
import 'react-rapid-carousel/dist/index.css'
import Card from 'card' // this Component are `children` of the `Slider`. For the best visual results, don't add `width` style property on it or `width: auto` is still okay.

const App = () => {
  const [products, setHeroes] = useState([])
  useEffect(() => {
    setTimeout(() => {
      setHeroes([
        { id: 1, title: 'car' },
        { id: 1, title: 'bike' },
        { id: 1, title: 'phone' },
        { id: 1, title: 'laptop' }
      ])
    }, 1000)
  }, [])

  return (
    <div>
      <Slider>
        {products.map((hero) => (
          <Card data={hero} key={hero.id} />
        ))}
      </Slider>
      
      <Slider
        // the `length` is endless :)
        breakpoints={[
          // define any width you want to break, but from from small to large widths
          { width: 391, slidesToShow: 1 },
          { width: 592, slidesToShow: 2 },
          { width: 830, slidesToShow: 3 },
          { width: 920, slidesToShow: 4 }
        ]}
      >
        {products.map((hero) => (
          <Card data={hero} key={hero.id} style={{ width: 'auto' }} />

          // Bad `width` style prop :(, Don't do it! Allow the Component do it for you, or use `breakpoints`
      for responsive desire
          // <Card  style={{ width: '200px' }} data={hero} key={hero.id} />
        ))}
      </Slider>
      // Best for rendering static content (Synchronous rendering)
      <Fader>
        <div>hi</div>
        <div>hello</div>
        <div>welcome</div>
        <div>goodbye</div>
      </Fader>
    </div>
  )
}

API

Components

Slider

| Prop | Type/Default | Description | | ------------ | :----------------------------------------------------------------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | quickSlide | boolean/false | Works with autoSlide and depends on slidesToShow: basically moves in sections: which makes much faster | | dots | boolean/false | Depends on slidesToShow: display dots below the Component for moving the slides to a particular section | | buttons | boolean/true | Display caret button: (next and prev buttons) for moving the slide back and forth | | slidesToShow | number/1 | The amount of slides to display at a time | | transition | string/"0.5s ease-in" | Css transition property | | children | Array<HTMLElement> || HTMLElement/null | These are the total amount slides to be eventually displayed: all slides, For the best visual results, don't add width style property on it or width: auto is still okay | | breakpoints | Array<{width: number: slidesToShow: number}>/null | For responsive experience: widths should be arranged in an ascending manner/order to get the desired result | | autoSlide | boolean/false || {reverse: boolean/false, pauseOnHover: boolean/true, pauseOnTab: boolean/true, interval: number/3800} | Adds animation: which happens after every interval which can be paused when the user hovers on the Slider or tabs on any focusable element and move in a reverse mode, if specified though |

Fader component

Fader can only render one slide at a time: perfect for heroes, banners, ads etc.... has lesser functionalities (but slower in performance, and should be used for rendering static content for best performance).

| Prop | Type/Default | Description | | ---------- | :---------------------------------------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | dots | boolean/true | Depends on slidesToShow: display dots below the Component for moving the slides to a particular section | | buttons | boolean/false | Display caret button: (next and prev buttons) for moving the slide back and forth | | transition | string/"0.5s ease-in" | Css transition property | | children | Array<HTMLElement> || HTMLElement /null | These are the total amount slides to be eventually displayed: all slides, For the best visual results, don't add width style property on it or width: auto is still okay | | autoSlide | boolean/true || {pauseOnHover: boolean/true, pauseOnTab: boolean/true, , interval: number/3800} | Adds animation: which happens after every interval which can be paused when the user hovers on the Slider or tabs on any focusable element and move in a reverse mode, if specified though |

ThemeProvider component

For changing the looks of buttons to match your brand

USAGE

import React, { useState } from 'react'

import { ThemeProvider, Slider, Fader } from 'react-rapid-carousel'
import 'react-rapid-carousel/dist/index.css'

const App = () => {
  return (
    <ThemeProvider
      theme={{
        dots: { 1: 'red', 2: 'orange' },
        carets: { 1: '#333', 2: '#3332' }
      }}
    >
      <Slider>
        <div>hi</div>
        <div>hello</div>
      </Slider>

      <ThemeProvider
        theme={{
          dots: { 1: 'blue', 2: 'cyan' },
          carets: { 1: 'gold', 2: 'rbg(20, 100, 225)' }
        }}
      >
        <Fader>
          <div>hi</div>
          <div>hello</div>
        </Fader>
      </ThemeProvider>
    </ThemeProvider>
  )
}

API

| Prop | Type / Default | | ----- | :-----------------------------------------------------------------------------------: | | theme | Object / { dots: { 1: '#333', 2: '#3332' }, carets: { 1: '#333', 2: 'transparent' } } |

License

MIT © chineduogada