Pagination

Component that divides up large datasets into manageable chunks.
Note

This component is awaiting validation by Reservix product teams. If your team has decided to implement the pagination component, please notify the Design System Team as soon as possible so that we can observe its implementation.

Pagination is used to divide and navigate large data sets, like a table or list of search results. It benefits users by reducing cognitive load as well as improving system performance.

Anatomy

The <Pagination> component consists of:

  • A “previous” button
  • A max of seven page buttons
  • A “next” button

Each page button is a text <Button> labelled with its respective page number. If the total number of pages exceeds seven, some pages will be hidden with an ellipsis (“…”).

Anatomy of pagination

Appearance

The appearance of a component can be customized using the variant and size props. These props adjust the visual style and dimensions of the component, available values are based on the active theme.

Variant
Size
The selected theme does not has any options for "variant" and "size".
PropertyTypeDescription
variant-The available variants of this component.
size-The available sizes of this component.

Usage

Pagination is used to divide large datasets into discrete pages, making them manageable and enhancing the user experience when browsing through search results or tables.

Use pagination when the amount of dataset results would be too overwhelming for one page, either for the user or the system performance.

Pagination is not a replacement for search, filter or sort functionality, but rather a complementary feature.

IDNameEmailRoleStatus
1User 1user1@example.comAdmininactive
2User 2user2@example.comUseractive
3User 3user3@example.comUseractive
4User 4user4@example.comAdminactive
5User 5user5@example.comUserinactive
6User 6user6@example.comUseractive
7User 7user7@example.comAdminactive
8User 8user8@example.comUseractive
9User 9user9@example.comUserinactive
10User 10user10@example.comAdminactive
Showing 1 - 10 of 35
Results per page
Do
Pagination must always be used in conjunction with a dataset and search, filter or sort features

Pagination must always be used in conjunction with a dataset and search, filter or sort features.

Don't
Don’t use pagination on its own without a connected dataset and search, filter or
sort features

Don’t use pagination on its own without a connected dataset and search, filter or sort features.

Managing results per page

Product teams must decide the default number of visible results per page when implementing the <Pagination> component.

Do

Set a sensible initial value for the number of visible results. This default value should protect the user as well as the system from being overloaded.

Results indicator

You can expand the <Pagination> component with a results indicator.

Results indicator in pagination
Showing 0 of 0
Results per page

An optional results indicator can be added to show:

  1. the range of visible results, and
  2. the amount of total results.

The indicator itself is not interactive.

The default text string is "Showing {range of visible results} of {total results}". Only change the default text if necessary for localization.

Don't
Don’t change default text strings unless necessary for localization. The default text string is “**Showing \{range of visible results\} of \{total results\}**”.

Don’t change default text strings unless necessary for localization. The default text string is “Showing {range of visible results} of {total results}”.

Quantity selector

You can expand the <Pagination> component with a quantity selector.

Quantity selector in pagination
Showing 0 of 0
Results per page

An optional quantity selector can be added to allow the user to control the amount of visible results per page. Product teams can decide the options available in the <Select> dropdown.

The default text string for the label is “Results per page”. Only change the default text if necessary for localization.

Don't
Don’t change default text strings unless necessary for localization. The default text string is “**Results per page**”.

Don’t change default text strings unless necessary for localization. The default text string is “Results per page”.

Summary: What decisions can product teams make?

  • The default amount of visible results per page
  • Whether to include the optional results indicator
    • The results indicator text string (only change for localization)
  • Whether to include the optional quantity selector
    • The quantity selector label text string (only change for localization)
    • The selectable values in the quantity selector dropdown
  • Whether to use labels on the “Previous” and “Next” buttons
    • The label text of the “Previous” and “Next” buttons (only change for localization)

Props

Did you know? You can explore, test, and customize props live in Marigold's storybook. Watch the effects they have in real-time!
controlLabels?
[string, string];
Labels for the pagination controls (Previous and Next button).
defaultPage?
number;
The initial page. (uncontrolled)
Defaults to:
1
onChange?
(page: number) => void;
Handler that is called when the pagination active page changes.
page?
number;
The current page. (controlled)
pageSize
number;
The number of items per page.
totalItems
number;
The number of total items.

Accessibility

The <Pagination> component already meets all known relevant WCAG 2.2 AA standards. Product teams are responsible for changing aria-labels if they modify the connected text strings for localization.

Do
Make sure to adjust any aria-labels if localizing the visible labels of the <i>previous</i> and <i>next</i> buttons, the text of the results indicator, or the label of the quantity selector.

Make sure to adjust any aria-labels if localizing the visible labels of the previous and next buttons, the text of the results indicator, or the label of the quantity selector.

Last update: 7 minutes ago