1.0.1 • Published 4 years ago

adam-component-pagination v1.0.1

Weekly downloads
24
License
-
Repository
-
Last release
4 years ago

adam-component-pagination

Overview

React pagination component. Demo - Storybook coming soon

Installation

npm i adam-component-pagination

Usage

Quick Start

import * as React from 'react';
import Pagination from 'adam-component-pagination';

interface IState {
  pageSize: number;
  currentPage: number;
  rowCount: number;
}
export default class PaginationExample extends React.Component<{}, IState> {
  constructor(props) {
    super(props);

    this.state = {
      pageSize: 10,
      currentPage: 1,
      rowCount: 1000,
    };
  }

  onPageChanged = (pageNumber: number, pageSize: number) => {
    this.setState({
      pageSize: pageSize,
      currentPage: pageNumber,
    });
  };

  render() {
    return <Pagination {...this.state} onPageChanged={this.onPageChanged} />;
  }
}

Play with this on CodeSandbox and read the documentation to learn more.

Props

The extended props of the pagination component.

NameTypeDefaultDescription
pageSizenumberThe number of results per page.
currentPagenumberThe selected page number.
rowCountnumberThe total row count to display.
pageRangenumber10The number of pages to display.
hidePageSizebooleanfalseIf true, page size selector will be hidden.
hidePageSummarybooleanfalseIf true, page summary will be hidden.
onFirstClickedfuncCallback fired when the first page is clicked.
onPreviousClickedfuncCallback fired when the previous page is clicked.
onNextClickedfuncCallback fired when the next page is clicked.
onLastClickedfuncCallback fired when the last page is clicked.
onPageChangedfuncCallback fired when the page number is changed.
1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-alpha.5

5 years ago

1.0.0-alpha.4

5 years ago

1.0.0-alpha.3

5 years ago

1.0.0-alpha.2

5 years ago

1.0.0-alpha.1

5 years ago

1.0.0-alpha

5 years ago