Examples › Pagination
You can enable pagination by setting the following Mantine DataTable properties:
page: number
The current page number.onPageChange
A callback that is executed when the user changes the current page.totalRecords: number
The total number of records in the dataset.recordsPerPage: number
The number of records per page.
If you’re not happy with the default pagination behavior, you can override it by setting these optional properties:
loadingText: string
A text to display while loading records.noRecordsText: string
A text to display when no records are present.paginationText
A callback receiving an object in the shape of{ from: number; to: number; totalRecords: number }and returning aReactNoderepresenting the pagination text.paginationSize: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
The pagination size.paginationWrapBreakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | (string & {}) | number
A breakpoint below which the pagination footer content will wrap on multiple lines. Defaults tosm.
You can also provide astringlike'300px'or'20rem', or anumber, in which case it will be interpreted as a pixel value and converted to rem value before being applied.paginationActiveTextColor: MantineColor | { light: MantineColor; dark: MantineColor }
Color applied to active page button text.
Can be aMantineColor(key oftheme.colorsor any valid CSS color string), or an object withlightanddarkkeys andMantineColorvalues.
Defaults to white.paginationActiveBackgroundColor: MantineColor | { light: MantineColor; dark: MantineColor }
Color applied to active page button background.
Can be aMantineColor(key oftheme.colorsor any valid CSS color string), or an object withlightanddarkkeys andMantineColorvalues.
Defaults to primary theme color.
Here is the code:
Displaying a page size selector
You can display a selector to let the user choose the page size by setting the following component properties:
recordsPerPageOptions: number[]
An array of page size numbers to display in the page size selector.onRecordsPerPageChange
A callback that is executed when the user changes the page size. Receives the new page size as its argument.recordsPerPageLabel
The page size selector label, defaulting to 'Records per page'.
Customizing pagination controls
You can fully customize pagination by providing the renderPagination prop. The callback receives a context with default controls as factories:
Controls.Text: the pagination text.Controls.PageSizeSelector: the page size selector (if enabled).Controls.Pagination: the pagination component.
This allows you to render them in any order, inject your own elements, or override their props. The example below shows how to add a "jump to page" control between page size selector and pagination controls.
Jump to page
Using pagination control props
You can provide additional props to pagination controls by using the getPaginationControlProps callback. For example, if you’re not happy with the default accessibility aria-labels, you can override them like so:
Head over to the next example to discover more features.














