Skip to content
+

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

Props of the native component are also available.

countRequired

The total number of rows.
To enable server side pagination for an unknown number of items, provide -1.

Type:number


onPageChangeRequired

Callback fired when the page is changed.

Type:func

Signature:
function(event: React.MouseEvent | null, page: number) => void
  • event The event source of the callback.
  • page The page selected.

pageRequired

The zero-based index of the current page.

Type:integer


rowsPerPageRequired

The number of rows per page.
Set -1 to display all the rows.

Type:integer


getItemAriaLabel

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.
For localization purposes, you can use the provided translations.

Type:func

Default:function defaultGetAriaLabel(type: ItemAriaLabelType) { return `Go to ${type} page`; }

Signature:
function(type: string) => string
  • type The link or button type to format ('first' | 'last' | 'next' | 'previous').

labelDisplayedRows

Customize the displayed rows label. Invoked with a { from, to, count, page } object.
For localization purposes, you can use the provided translations.

Type:func

Default:function defaultLabelDisplayedRows({ from, to, count }: LabelDisplayedRowsArgs) { return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`; }


labelId

Id of the label element within the pagination.

Type:string


labelRowsPerPage

Customize the rows per page label.
For localization purposes, you can use the provided translations.

Type:node

Default:'Rows per page:'


onRowsPerPageChange

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

Type:func

Signature:
function(event: React.ChangeEvent) => void
  • event The event source of the callback.

rowsPerPageOptions

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.

Type:Array<number
| { label: string, value: number }>

Default:[10, 25, 50, 100]


selectId

Id of the select element within the pagination.

Type:string


slotProps

The props used for each slot inside the TablePagination.

Type:{ actions?: func
| object, displayedRows?: func
| object, menuItem?: func
| object, root?: func
| object, select?: func
| object, selectLabel?: func
| object, spacer?: func
| object, toolbar?: func
| object }

Default:{}


slots

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.

Type:{ actions?: elementType, displayedRows?: elementType, menuItem?: elementType, root?: elementType, select?: elementType, selectLabel?: elementType, spacer?: elementType, toolbar?: elementType }

Default:{}



The ref is forwarded to the root element.

Slots

To learn how to customize the slot, check out the Overriding component structure guide.

root

The component that renders the root.

Class name: .base-TablePagination-root

Default component: 'td'


actions

The component that renders the actions.

Class name: .base-TablePagination-actions

Default component: TablePaginationActions


select

The component that renders the select.

Class name: .base-TablePagination-select

Default component: 'select'


selectLabel

The component that renders the select label.

Class name: .base-TablePagination-selectLabel

Default component: 'p'


menuItem

The component that renders the menu item.

Class name: .base-TablePagination-menuItem

Default component: 'option'


displayedRows

The component that renders the displayed rows.

Class name: .base-TablePagination-displayedRows

Default component: 'p'


toolbar

The component that renders the toolbar.

Class name: .base-TablePagination-toolbar

Default component: 'div'


spacer

The component that renders the spacer.

Class name: .base-TablePagination-spacer

Default component: 'div'


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.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.