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-library-paginator

v2.0.0

Published

React bootstrap-oriented customizable paginator component

Downloads

35

Readme

react-library-paginator

A React bootstrap-oriented customizable paginator component written in typescript.

NPM JavaScript Style Guide

Features included:

  • Paging functionality - tested and proven to work, will make those pages appear on the screen,
  • Includes built-in styles - default styling, for the lazy ones,
  • Boostrap-friendly - compatible with Boostrap 4, for the conservative ones,
  • Customizable styles - allows to customize styles via css classes or inline styles, for the love-to-customize-things ones,
  • Customizable navigation - allows to customize paginator navigation elements.

Demo

Check out demo showing a few common use-cases.

Install

npm install --save react-library-paginator

Usage

import React, { Component } from 'react';

import Paginator from 'react-library-paginator';

export default class BasicPaginator extends Component {
  state = { page: 1, totalItems: 120 };
  handlePageChange = page => {
    this.setState({ page });
  };
  render() {
    const { page, totalItems } = this.state;
    return (
      <Paginator
        totalItems={totalItems}
        currentPage={page}
        onPageChange={this.handlePageChange}
        classes={{
          container: 'paginator-container',
          list: 'paginator-list',
          pageItem: 'paginator-item',
          pageLink: 'paginator-link',
          pageLinkActive: 'paginator-link--active',
          pageLinkDisabled: 'paginator-link--disabled'
        }}
      />
    );
  }
}

API

| Name | Type | Default | Description | | ------------------- | ---------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | | totalItems | number | Required | Total number of items that will be paginated. | | onPageChange | function | Required | Event that is triggered when the page changes. The new page number is passed into the event handler function. | | currentPage | number | 1 | Number of the current page. | | itemsPerPage | number | 10 | How many items are displayed per one page. | | maxPagesToShow | number | 3 | How many page numbers should be visible in the paginator between previous and next navigation symbols. | | useBootstrapClasses | bool | false | Indicates whether to apply bootstrap 4 pagination classes (e.g. pagination, page-item etc) to the paging elements. | | styles | object | {} | Object defining class names for the paging elements (see below). | | classes | object | {} | Object defining inline styles for the paging elements (see below). | | navigation | object | {} | Object customizing visibility and texts for paginator navigation elements (see below). |

Classes and styles

| Object key | Type (classes/styles) | Description | | ---------------- | --------------------- | -------------------------------------------------------------------------------- | | container | string/object | Class name/style object for the outer container (nav). | | list | string/object | Class name/style object for the paginator list (ul). | | pageItem | string/object | Class name/style object for the paginator list item (li). | | pageLink | string/object | Class name/style object for the link inside the list item (a). | | pageLinkActive | string/object | Class name/style object for the link of currently selected page. | | pageLinkDisabled | string/object | Class name/style object for the link of non-selectable pages/navigation symbols. |

Navigation

| Object key | Type | Description | | ---------------- | --------- | ------------------------------------------------------------------- | | firstPageText | string | Text displayed inside navigation element for the first page . | | prevPageText | string | Text displayed inside navigation element for the previous page. | | nextPageText | string | Text displayed inside navigation element for the next page . | | lastPageText | string | Text displayed inside navigation element for the last page . | | hideFirstPageNav | boolean | Indicates whether to hide navigation element for the first page. | | hidePrevPageNav | boolean | Indicates whether to hide navigation element for the previous page. | | hideNextPageNav | boolean | Indicates whether to hide navigation element for the next page . | | hideLastPageNav | boolean | Indicates whether to hide navigation element for the last page . |

Contributing

Contributions are welcome, bug reports, pull requests, feature requests are highly appreciated and rewarded with lightning fast responses and developing!

License

MIT © MargaretKrutikova