Skip to Content

TablePagination

A table pagination component lets users navigate through tabular data split across multiple pages.

Expand code
<TablePagination entries={200}/>

Entries

The entries prop determines, how many total rows will be available to navigate.

Expand code
<EntriesPagination entries={500}/> <EntriesPagination entries={1000}/>

Rows

By default, users can select between 10, 25, 50 or 100 rows to be displayed at a time. Use the rows prop to override the select options.

Expand code
<EntriesPagination entries={500} rows={[25, 50, 100]}/> <EntriesPagination entries={1000} rows={[50, 100, 250]}/>

Text overrides

RowLabel

The rowLabel sets the text before the select dropdown.

Expand code
<TablePagination entries={200} rowLabel={'Select amount of rows to display'}/>

EntriesDescription

The entriesDescription overrides the text between the current rows and total entries.

Expand code
<TablePagination entries={200} entriesDescription={'/'}/>

ActivePage

You can set the currently selected page (defaults to 1) with the activePage prop.

Expand code
<TablePagination entries={200} activePage={3}/>

Pages will be calculated based on the entries and currently selected row count.
If the prop is greater than the calculated number of pages, it will fall back to the last page.
If it is smaller than 0, it will fall back to 1.

Change detection

You can handle navigation changes with the prop onChange.
The function uses two parameters: newPage, the navigated page & count, the currently selected row count.

Control customization

The navigation controls can be customized, by overriding the icons or aria-labels.

Expand code
const next = <svg>...</svg> const prev = <svg>...</svg> <TablePagination entries={200} activePage={3} nextLabel={'Next'} prevLabel={'Previous'} nextButton={next} prevButton={prev} />

Props

NameTypeDefaultDescription
activePagenumber1currently selected page
entriesnumber-Number of total entries
entriesDescriptionstringofSets the text between current rows & total rows
nextButtonnode-Use a custom icon
nextLabelstringGo to next pageSets aria-label attribute
onChangefunction-On change, get the current page
prevButtonnode-Use a custom icon
prevLabelstringGo to previous pageSets aria-label attribute
rowLabelstringRows per pageSets text before the select dropdown
rowsnumber[][10, 25, 50, 100]Sets row count options
Last updated on