Перейти к контенту

TablePagination API

API documentation for the React TablePagination component. Learn about the available props, and the CSS API.

Import

import TablePagination from '@material-ui/core/TablePagination';
// или
import { TablePagination } from '@material-ui/core';
You can learn about the difference by reading this guide on minimizing bundle size.

A TableCell based component for placing inside TableFooter for pagination.

Component name

The name MuiTablePagination can be used when providing default props or style overrides in the theme.

Props

ИмяТипПо-умолчаниюОписание
count*integerThe total number of rows.
To enable server side pagination for an unknown number of items, provide -1.
onPageChange*funcCallback fired when the page is changed.

Signature:
function(event: object, page: number) => void
event: The event source of the callback.
page: The page selected.
page*integerThe zero-based index of the current page.
rowsPerPage*integerThe number of rows per page.
Set -1 to display all the rows.
ActionsComponentelementTypeTablePaginationActionsThe component used for displaying the actions. Either a string to use a HTML element or a component.
backIconButtonPropsobjectProps applied to the back arrow IconButton component.
classesobjectOverride or extend the styles applied to the component. See CSS API below for more details.
componentelementTypeThe component used for the root node. Either a string to use a HTML element or a component.
getItemAriaLabelfuncfunction defaultGetAriaLabel(type) { return `Go to ${type} page`; }Accepts a function which returns a string value that provides a user-friendly name for the current page.
For localization purposes, you can use the provided translations.

Signature:
function(type: string) => string
type: The link or button type to format ('first' | 'last' | 'next' | 'previous').
labelDisplayedRowsfuncfunction defaultLabelDisplayedRows({ from, to, count }) { return `${from}-${to} of ${count !== -1 ? count : `more than ${to}`}`; }Customize the displayed rows label. Invoked with a { from, to, count, page } object.
For localization purposes, you can use the provided translations.
labelRowsPerPagenode'Rows per page:'Customize the rows per page label.
For localization purposes, you can use the provided translations.
nextIconButtonPropsobjectProps applied to the next arrow IconButton element.
onRowsPerPageChangefuncCallback fired when the number of rows per page is changed.

Signature:
function(event: object) => void
event: The event source of the callback.
rowsPerPageOptionsArray<number
| { label: string, value: number }>
[10, 25, 50, 100]Customizes the options of the rows per page select field. If less than two options are available, no select field will be displayed.
SelectPropsobject{}Props applied to the rows per page Select element.
showFirstButtonboolfalseIf true, show the first-page button.
showLastButtonboolfalseIf true, show the last-page button.
sxobject

The ref is forwarded to the root element.
Any other props supplied will be provided to the root element (TableCell).

Inheritance

While not explicitly documented above, the props of the TableCell component are also available on TablePagination. You can take advantage of this to target nested components.

CSS

Rule nameGlobal classОписание
root.MuiTablePagination-rootStyles applied to the root element.
toolbar.MuiTablePagination-toolbarStyles applied to the Toolbar component.
spacer.MuiTablePagination-spacerStyles applied to the spacer element.
selectLabel.MuiTablePagination-selectLabel
selectRoot.MuiTablePagination-selectRootStyles applied to the Select component root element.
select.MuiTablePagination-selectStyles applied to the Select component `select` class.
selectIcon.MuiTablePagination-selectIconStyles applied to the Select component `icon` class.
input.MuiTablePagination-inputStyles applied to the InputBase component.
menuItem.MuiTablePagination-menuItemStyles applied to the MenuItem component.
displayedRows.MuiTablePagination-displayedRows
actions.MuiTablePagination-actionsStyles applied to the internal `TablePaginationActions` component.

You can override the style of the component using one of these customization options:

Demos