Pular para o conteúdo

🎉 Material UI v5 is out! Head to the migration guide to get started.

TablePagination API

The API documentation of the TablePagination React component. Learn more about the props and the CSS customization points.

Import

import TablePagination from '@material-ui/core/TablePagination';
// or
import { TablePagination } from '@material-ui/core';

You can learn more about the difference by reading this guide.

A TableCell based component for placing inside TableFooter for pagination.

Component name

The MuiTablePagination name can be used for providing default props or style overrides at the theme level.

Props

Name Type Default Description
ActionsComponent elementType TablePaginationActions The component used for displaying the actions. Either a string to use a HTML element or a component.
backIconButtonProps object Props applied to the back arrow IconButton component.
backIconButtonText string 'Previous page' Text label for the back arrow icon button.
For localization purposes, you can use the provided translations.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
component elementType TableCell The component used for the root node. Either a string to use a HTML element or a component.
count* number The total number of rows.
To enable server side pagination for an unknown number of items, provide -1.
labelDisplayedRows func ({ from, to, count }) =>${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.
labelRowsPerPage node 'Rows per page:' Customize the rows per page label.
For localization purposes, you can use the provided translations.
nextIconButtonProps object Props applied to the next arrow IconButton element.
nextIconButtonText string 'Next page' Text label for the next arrow icon button.
For localization purposes, you can use the provided translations.
onChangePage func Deprecated. Use the onPageChange prop instead.

Callback fired when the page is changed.
onChangeRowsPerPage func Deprecated. Use the onRowsPerPageChange prop instead.

Callback fired when the number of rows per page is changed.
onPageChange* func Callback fired when the page is changed.

Signature:
function(event: object, page: number) => void
event: The event source of the callback.
page: The page selected.
onRowsPerPageChange func Callback fired when the number of rows per page is changed.

Signature:
function(event: object) => void
event: The event source of the callback.
page* number The zero-based index of the current page.
rowsPerPage* number The number of rows per page.
rowsPerPageOptions array [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.
SelectProps object {} Props applied to the rows per page Select element.

The ref is forwarded to the root element.

Any other props supplied will be provided to the root element (TableCell).

CSS

Rule name Global class Description
root .MuiTablePagination-root Styles applied to the root element.
toolbar .MuiTablePagination-toolbar Styles applied to the Toolbar component.
spacer .MuiTablePagination-spacer Styles applied to the spacer element.
caption .MuiTablePagination-caption Styles applied to the caption Typography components if variant="caption".
selectRoot .MuiTablePagination-selectRoot Styles applied to the Select component root element.
select .MuiTablePagination-select Styles applied to the Select component select class.
selectIcon .MuiTablePagination-selectIcon Styles applied to the Select component icon class.
input .MuiTablePagination-input Styles applied to the InputBase component.
menuItem .MuiTablePagination-menuItem Styles applied to the MenuItem component.
actions .MuiTablePagination-actions Styles applied to the internal TablePaginationActions component.

You can override the style of the component thanks to one of these customization points:

If that's not sufficient, you can check the implementation of the component for more detail.

Inheritance

The props of the TableCell component are also available. You can take advantage of this behavior to target nested components.

Demos