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-card-scroll

v2.2.4

Published

A React component to navigate horizontally between cards of same width

Downloads

96

Readme

react-card-scroll

Travis Codecov npm

A React component to horizontally navigate between components of same width (Bootstrap cards for example).
It is responsive and support dynamic card adds and removes.

You decide how many cards will be simultaneously visible depending on screen size, in the bootstrap style. You can then navigate to the other cards depending on how you want to implement it. If you don't want to implement anything, you can use default arrows.

Visually you have a left stack of cards, visible cards in the middle, and a right stack.

New in 2.x

New in 2.1: expose stacks parameters
Using stacks instead of sliding cards out of the screen
Pass children CSS class as props
Doesn't use react-motion anymore

Installation

npm i -S react-card-scroll

Usage

Import css either in sass ~react-card-scroll/lib/assets/styles.css or in javascript with webpack

Use bootstrap style to decide how many cards will be visible at a give screen size (just add rcs-): rcs-col-*-*. You don't have to include bootstrap.

Choose how you want to implement the navigation by using scrollCards({toLeft: true/false, number:*}).For example, you can scroll when you click on a stack or when you wheel your mouse with the pointer on a card title. See the example: npm run example and open localhost:8081. And get inspiration from the source code.

You can know where a card is with the getCardOffset function in JavaScript, or with the CSS classes rcs-left-stack rcs-center rcs-right-stack

Use default navigation arrows with props showArrows={true}

You can change the default parameters visibleStack et stackSpace, which determine how many cards of the stacks are shifted on the sides, and by how many pixels.

Example demo

react-card-scroll

Some (very) basic usage

<CardScroll 
    ref="cardScroll" 
    childrenClass="rcs-col-sm-6 rcs-col-md-4"
    visibleStack={1}
    stackSpace={25}>
    <div>
        Hello
    </div>
    
    <div>
        World
    </div>
    
    <div>
        Foo
    </div>
    
    <div>
        Bar
    </div>
</CardScroll>

From parent, trigger navigation when you want (add or remove cards, click somewhere, mouse wheel, ...):

this.refs.cardScroll.scrollCards({toLeft: true, number:1})

TODO

  • [ ] Improve margin stack algorithm