TablePagination API
API reference docs for the React TablePagination component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import TablePagination from '@mui/material/TablePagination';
// or
import { TablePagination } from '@mui/material';
Learn about the difference by reading this guide on minimizing bundle size.
A TableCell
based component for placing inside TableFooter
for pagination.
Props of the TableCell component are also available.
Name | Type | Default | Description |
---|---|---|---|
count* | integer | - | The total number of rows. |
onPageChange* | func | - | Callback fired when the page is changed. Signature: function(event: React.MouseEvent
|
page* | integer | - | The zero-based index of the current page. |
rowsPerPage* | integer | - | The number of rows per page. |
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 |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
component | elementType | - | The component used for the root node. Either a string to use a HTML element or a component. |
disabled | bool | false | If |
getItemAriaLabel | func | function 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. This is important for screen reader users. Signature: function(type: string) => string
|
labelDisplayedRows | func | function defaultLabelDisplayedRows({ from, to, count }) { return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`; } | Customize the displayed rows label. Invoked with a |
labelRowsPerPage | node | 'Rows per page:' | Customize the rows per page label. |
nextIconButtonProps | object | - | Props applied to the next arrow |
onRowsPerPageChange | func | - | Callback fired when the number of rows per page is changed. Signature: function(event: React.ChangeEvent
|
rowsPerPageOptions | Array<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. Use -1 for the value with a custom label to show all the rows. |
SelectProps | object | {} | Props applied to the rows per page |
showFirstButton | bool | false | If |
showLastButton | bool | false | If |
slotProps | { actions?: { firstButton?: object, firstButtonIcon?: object, lastButton?: object, lastButtonIcon?: object, nextButton?: object, nextButtonIcon?: object, previousButton?: object, previousButtonIcon?: object }, displayedRows?: func | object, menuItem?: func | object, root?: func | object, select?: object, selectLabel?: func | object, spacer?: func | object, toolbar?: func | object } | {} | The props used for each slot inside. |
slots | { actions?: { firstButton?: elementType, firstButtonIcon?: elementType, lastButton?: elementType, lastButtonIcon?: elementType, nextButton?: elementType, nextButtonIcon?: elementType, previousButton?: elementType, previousButtonIcon?: elementType }, displayedRows?: elementType, menuItem?: elementType, root?: elementType, select?: elementType, selectLabel?: elementType, spacer?: elementType, toolbar?: elementType } | {} | The components used for each slot inside. |
sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
ref
is forwarded to the root element.Inheritance
While not explicitly documented above, the props of the TableCell component are also available in TablePagination. You can take advantage of this to target nested components.
Theme default props
You can use MuiTablePagination
to change the default props of this component with the theme.
Slot name | Class name | Default component | Description |
---|---|---|---|
root | .MuiTablePagination-root | TableCell | The component that renders the root slot. Follow this guide to learn more about the requirements for this component. |
toolbar | .MuiTablePagination-toolbar | Toolbar | The component that renders the toolbar slot. Follow this guide to learn more about the requirements for this component. |
spacer | .MuiTablePagination-spacer | 'div' | The tag that renders the spacer slot. |
selectLabel | .MuiTablePagination-selectLabel | 'p' | The tag that renders the selectLabel slot. |
select | .MuiTablePagination-select | Select | The component that renders the select slot. Follow this guide to learn more about the requirements for this component. |
menuItem | .MuiTablePagination-menuItem | MenuItem | The component that renders the select slot. Follow this guide to learn more about the requirements for this component. |
displayedRows | .MuiTablePagination-displayedRows | 'p' | The tag that renders the displayedRows slot. |
actions | .MuiTablePagination-actions | The slots that passed to the actions slot. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiTablePagination-input | input | Styles applied to the Select component root element. |
.MuiTablePagination-selectIcon | selectIcon | Styles applied to the Select component icon class. |
.MuiTablePagination-selectRoot | selectRoot | Styles applied to the Select component root element. |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.