Skip to main content

Pagination

Moves through pages of results.

<mm-pagination page="1" page-size="50" total="1284019" page-sizes="25,50,100"></mm-pagination>
<mm-pagination variant="compact" page="3" page-size="50" total="1284"></mm-pagination>
<!-- Cursor pagination: no total -->
<mm-pagination page="3" page-size="50" has-next></mm-pagination>

Guidance​

Pagination moves through long result sets: Discover results, the query audit log, run history. It is a nav landmark labelled "Pagination" with previous and next buttons, page numbers with ellipses, and a "Showing 1–50 of 1,284,019" readout in tabular figures. The current page carries aria-current="page" and the selection tint with ink text. An optional page-size select offers 25, 50 and 100 rows; changing it keeps the first visible row on screen.

variant="compact" shows only previous, "Page 3 of 26" and next, for blades and narrow panels. Leave total unset for cursor pagination, where the total is unknown: only previous and next show, and has-next says whether there is another page.

Every control is a native button in the tab order (there is no composite keyboard model): Tab moves through them and Enter or Space activates. Previous and next stay focusable when disabled (aria-disabled), so focus is not lost on the first or last page.

Properties​

PropertyAttributeTypeDefaultDescription
pagepagenumber1The current page, from 1.
pageSizepage-sizenumber50Rows per page.
totaltotalnumber | undefinedTotal rows. Leave unset (or negative) for cursor pagination with an unknown total.
hasNexthas-nextbooleanfalseWith an unknown total, whether there is a next page.
variantvariant'default' | 'compact''default'default (page numbers) or compact (previous, "Page 3 of 26", next).
pageSizespage-sizesstring''Page sizes offered in the page-size select, comma separated. Empty hides the select.
siblingssiblingsnumber1Pages shown either side of the current one before an ellipsis.
labellabelstring''Accessible name of the landmark, when a page has more than one paginated list. Defaults to "Pagination".
disableddisabledbooleanfalseDisables every control, for example while a page loads.
pageCountnumber | undefinedNumber of pages, or undefined when the total is unknown.

Methods​

MethodDescription
goTo()Goes to a page as if the user had chosen it, and fires mm-page-change.

Events​

EventDetailDescription
mm-page-changeCustomEvent<MmPageChangeDetail>The page or page size changed by user action.

CSS parts​

PartDescription
navThe nav landmark.
summaryThe "Showing 1–50 of 1,284,019" readout.
pagesThe list of page buttons.
pageEach page button.
page-sizeThe page-size select.

Examples​

Every state of mm-pagination in Storybook, with keyboard and screen reader tests.