Socket
Socket
Sign inDemoInstall

react-pager

Package Overview
Dependencies
42
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-pager

Stateless Pager component.


Version published
Maintainers
1
Install size
1.38 MB
Created

Readme

Source

Stateless Pager component

NPM version Code Climate Build Status

Getting started

browserify

var Pager = require( 'react-pager' );

Global scripts

dist/pager.min.js is prebuilded for using in global <script> tag. (It's used in JSFiddle demo).

Usage

var Pager = require( 'react-pager' );

var PagerDemo = React.createClass({
    getInitialState: function () {
        return {
            total:        11,
            current:      7,
            visiblePages: 3
        };
    },
    
    handlePageChanged: function ( newPage ) {
        this.setState({ current : newPage });
    },
    
    render: function() {
        return (<Pager total={this.state.total}
                       current={this.state.current}
                       
                       {/* Optional */}
                       titles={{
                           first:   'First',
                           prev:    '\u00AB',
                           prevSet: '...',
                           nextSet: '...',
                           next:    '\u00BB',
                           last:    'Last'
                       }}
                       
                       visiblePages={this.state.visiblePages}
                       onPageChanged={this.handlePageChanged}/>);
    }
});

React.render(<PagerDemo />, document.body);

How it looks like*

First | Prev | ... | 6 | 7 | 8 | 9 | ... | Next | Last

* Bootstrap 3.0 is required by default, but you can replace it with your own css.

Demo

gulp demo -p 8003 

or

./node_modules/.bin/gulp demo -p 8003

JSFiddle

Tests

npm test

Changelog

v1.1.1

  • Updated to React 0.13.
  • Updated local demo.

v1.1.0

  • Added titles property. See demo.
  • Improved building script.

v1.0.6

  • Fixed <li class="undefined" .. in "more" and "less" buttons.
  • Added a few unit-tests.

Contributors

Keywords

FAQs

Last updated on 05 Dec 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc