UNPKG

terra-paginator

Version:

Paginator to be used for data sets of known and unknown size. Provides first, last, previous, next, and paged functionality.

44 lines (31 loc) 1.54 kB
# Terra Controlled Paginator Controlled version of the [Paginator](https://github.com/cerner/terra-core/packages/terra-paginator/docs/README.md) for when the pagination state needs to be managed by a parent component. To use this component, the selectedPage must be managed through the state of a parent component, and passed into this paginator through props. ## Getting Started - Install with [npmjs](https://www.npmjs.com): - `npm install terra-paginator` ## Usage ```jsx import React from 'react'; import ControlledPaginator from 'terra-paginator/lib/ControlledPaginator'; class ControlledPaginatorExample extends React.Component { constructor(props) { super(props); this.state = { currentPage: 1, }; this.changePages = this.changePages.bind(this); } changePages(index) { this.setState({ currentPage: index }); } render() { return ( <ControlledPaginator onPageChange={this.changePages} selectedPage={this.state.currentPage} totalCount={450} itemCountPerPage={10} /> ); } } ``` ## Component Features * [Cross-Browser Support](https://github.com/cerner/terra-ui/blob/master/src/terra-dev-site/contributing/ComponentStandards.e.contributing.md#cross-browser-support) * [Responsive Support](https://github.com/cerner/terra-ui/blob/master/src/terra-dev-site/contributing/ComponentStandards.e.contributing.md#responsive-support) * [Mobile Support](https://github.com/cerner/terra-ui/blob/master/src/terra-dev-site/contributing/ComponentStandards.e.contributing.md#mobile-support)