# materialui-pagination

> A simple pagination component for Material UI.

Latest version **0.0.6** (published 2017-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install materialui-pagination
pnpm add materialui-pagination
yarn add materialui-pagination
bun add materialui-pagination
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2017-05-26 |
| First published | 2017-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | franciskim722 |
| Keywords | react, react-component, material design, material-ui, materialui-pagination, material-ui-pagination, materialui-paginate, materialui-pagination |

## Links

- npm: https://www.npmjs.com/package/materialui-pagination
- Repository: https://github.com/franciskim722/materialui-pagination
- Homepage: https://github.com/franciskim722/materialui-pagination#readme
- Issues: https://github.com/franciskim722/materialui-pagination/issues
- npm.io page: https://npm.io/package/materialui-pagination

## Dependencies (5)

- [react](https://npm.io/package/react.md) ^15.4.2
- [react-dom](https://npm.io/package/react-dom.md) ^15.4.2
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.8
- [material-ui](https://npm.io/package/material-ui.md) ^0.17.0
- [react-tap-event-plugin](https://npm.io/package/react-tap-event-plugin.md) ^2.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2017-05-26
- 0.0.5 — 2017-05-25
- 0.0.4 — 2017-05-24
- 0.0.3 — 2017-05-24
- 0.0.2 — 2017-05-24
- 0.0.1 — 2017-05-24
- 1.0.1 — 2017-05-22
- 1.0.0 — 2017-05-22

## README

# materialui-pagination

A simple pagination component for Material UI.

Based on [Material Design Data Table Guidelines](https://material.io/guidelines/components/data-tables.html#data-tables-structure).

![Demo](http://imgur.com/4dZkuEw.gif)

## Installation
```sh
$ npm install materialui-pagination
```

## Example
```js

  //React
  import React  from 'react';
  import PropTypes from 'prop-types';
  import {render} from 'react-dom';

  //Material UI Dependency for touch / tap / click events
  import injectTapEventPlugin from 'react-tap-event-plugin';
  injectTapEventPlugin();

  //Material UI Components
  import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
  import {Card} from 'material-ui/Card';
  import Divider from 'material-ui/Divider';
  import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn} from 'material-ui/Table';

  //Import the pagination component
  import Pagination from 'materialui-pagination';

  //Demo API to simulate async actions
  import RowApi from './api/rows';

  class ExampleTable extends React.Component {

      constructor(props, context) {
          super(props, context);
    
          this.state = {
            rowsPerPage: [5,10,15],
            rows: [],
            numberOfRows: 5,
            page: 1,
            total: undefined
          };

            this.updateRows = this.updateRows.bind(this);
      }


      componentWillMount() {
        RowApi.getRows(this.state)
        .then((updatedState) => {
          this.setState(updatedState);
        });
      }

      updateRows(state){
        RowApi.getRows(state)
        .then((updatedState) => {
          this.setState(updatedState);
        });
      }

      render(){
          return (
            <MuiThemeProvider>
              <Card>
                <Table>
                  <TableHeader>
                    <TableRow>
                      <TableHeaderColumn>Row Number</TableHeaderColumn>
                    </TableRow>
                  </TableHeader>
                  <TableBody>
                  {this.state.rows.map((row, index) => {
                      return (
                        <TableRow key={index}>
                          <TableRowColumn>{row}</TableRowColumn>
                        </TableRow>
                      );
                    })}
                  </TableBody>
                </Table>
                <Divider />
                <Pagination
                  total={this.state.total}
                  rowsPerPage={this.state.rowsPerPage}
                  page={this.state.page}
                  numberOfRows={this.state.numberOfRows}
                  updateRows={this.updateRows}
                />
              </Card>
            </MuiThemeProvider>
          );
      }
  }

  render(<ExampleTable />, document.querySelector('#app'))
```


## Pagination Properties

| Name | Type | Default | Description |
| ------ | ------ | ------ | ------ |
| rowsPerPage | array | [10, 20, 30] | The number of rows to display per page. |
| numberOfRows | number | 10 | The selected number of rows to display. |
| page | number | 1 | The selected page number. |
| total | number | 0 | The total number of results in the dataset. |
| updateRows | function |  | Callback function fired when the rows array is updated. |

---
_Source: https://npm.io/package/materialui-pagination · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
