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-shift

v2.2.0

Published

React carousel/slider with pagination.

Downloads

43

Readme

react-shift

A paginated "carousel-like" component for JSX elements. Can be used to serve pages of content or dropped as a small component into a larger stack.

Currently hard-swaps content, so smooth scrolling/sliding can only be simulated using ReactCSSTransitionGroup.

Installation

npm install react-shift --save

Getting started

render(
  <Shift>
    <div>First page</div>
    <div>Second page</div>
    <div>Third page</div>
  </Shift>,
  node
);

Props

The component can be passed objects as props to customize the navigation and page elements.

Name | Type | Properties | Description | Default ------------- | ------------- | ------------- | ------------- | ------------- arrowLabels | object | next, previous | Specifies custom next and previous page link labels. | { next: 'Next page', previous: 'Previous page' } fastLinks | object | Custom key/value pairs each defining a fast links. | Creates a shortcut link to a page, where the key is the link name and the value is the page index to link to. | null fakeLinks | boolean | N/A | Toggles psuedohyperlinking on naviation elements. | true transitions | object | active, name | Used to activate and define ReactCSSTransitionGroup on the page subcomponent. | null classes | object | wrapper, navigation, page, pagination, pageNumber1, currentPage, fastLinks, navArrow, nextPage, previousPage, arrowFiller2 | Passes class names to subcomponent className properties. | null styles | object | wrapper, navigation, page, pagination, pageNumber3, currentPage, fastLinks, navArrow, nextPage, previousPage, arrowFiller2 | Passes styles to subcomponent style properties. | null scrollable4 | boolean | N/A | Specifies if mouse wheel scrolling events on the page subcomponent triggers page changes. | false

1 pageNumber applies that generic className every page number element, but also creates a unique class name on each page number using ${yourDefinedClass}-${pageIndex}.

2 arrowFiller can be used to override navArrow styling normally applied to the empty space reserved for page arrows.

3 Unlike the className version, this prop does not currently offer unique styling for each page index number.

4 This feature is highly experimental and not recommended for use. Seriously, don't use it; it makes the component nearly unusable on laptop touchpads and mobile devices.

Advanced example:

const arrowLabels = {
  next: '>>>',
  previous: '<<<'
};

const fastLinks = {
  'Third page': 2,
  'Fifth page': 4
};

const classes = {
  navigation: 'react-shift-navigation',
  page: 'react-shift-page',
  pagination: 'react-shift-pagination',
  pageNumber: 'react-shift-page-number',
  currentPage: 'react-shift-current-page',
  fastLinks: 'react-shift-fast-link',
  navArrow: 'react-shift-nav-arrow',
  nextPage: 'react-shift-next-page',
  previousPage: 'react-shift-previous-page'
};

ReactDOM.render(
  <Shift
    classes={classes}
    arrowLabels={arrowLabels}
    fastLinks={fastLinks}
    transitions={transitions}
      <div>First page</div>
      <div>Second page</div>
      <div>Third page</div>
  </Shift>,
  document.getElementById('react-shift-anchor')
);

Demo

npm run demo

Open demo.html in a browser.