Table Pagination
Table Pagination is an interface tool for splitting up large amounts of data to make it easier for users to navigate.
TablePagination API
Import
import { TablePagination } from '@mui/base/TablePagination';
// or
import { TablePagination } from '@mui/base';
Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
count* | number | - | 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. |
getItemAriaLabel | func | function defaultGetAriaLabel(type: ItemAriaLabelType) { 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 }: LabelDisplayedRowsArgs) { return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`; } | Customize the displayed rows label. Invoked with a |
labelId | string | - | Id of the label element within the pagination. |
labelRowsPerPage | node | 'Rows per page:' | Customize the rows per page label. |
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. |
selectId | string | - | Id of the select element within the pagination. |
slotProps | { actions?: func | object, displayedRows?: func | object, menuItem?: func | object, root?: func | object, select?: func | object, selectLabel?: func | object, spacer?: func | object, toolbar?: func | object } | {} | The props used for each slot inside the TablePagination. |
slots | { actions?: elementType, displayedRows?: elementType, menuItem?: elementType, root?: elementType, select?: elementType, selectLabel?: elementType, spacer?: elementType, toolbar?: elementType } | {} | The components used for each slot inside the TablePagination. Either a string to use a HTML element or a component. See Slots API below for more details. |
ref
is forwarded to the root element.To learn how to customize the slot, check out the Overriding component structure guide.
Slot name | Class name | Default component | Description |
---|---|---|---|
root | .base-TablePagination-root | 'td' | The component that renders the root. |
actions | .base-TablePagination-actions | TablePaginationActions | The component that renders the actions. |
select | .base-TablePagination-select | 'select' | The component that renders the select. |
selectLabel | .base-TablePagination-selectLabel | 'p' | The component that renders the select label. |
menuItem | .base-TablePagination-menuItem | 'option' | The component that renders the menu item. |
displayedRows | .base-TablePagination-displayedRows | 'p' | The component that renders the displayed rows. |
toolbar | .base-TablePagination-toolbar | 'div' | The component that renders the toolbar. |
spacer | .base-TablePagination-spacer | 'div' | The component that renders the spacer. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Description |
---|---|
.base-TablePagination-input | Class name applied to the Select component root element. |
.base-TablePagination-selectIcon | Class name applied to the Select component icon class. |
.base-TablePagination-selectRoot | Class name applied to the Select component root element. |