GC Design System Components Installation Page templates Contact us Get involved Find a demo GC Design System Components

Pagination
<gcds-pagination>

Also called: page index, page navigation.

Pagination is a division of content into multiple linked pages.

Pagination component preview

Build a pagination component

Use pagination to break up content and spread it over numerous pages. This can help make large content sections easier to read and gives a person a sense of their position within the documents.

Coding and accessibility for pagination

Set up simple pagination

Use simple pagination for a smaller number of pages.

Set up list styled pagination

Use list styled pagination when you are dealing with a larger number of pages.

Apply the URL object for list-style pagination

Use the url object to generate the query strings and fragments for the list pagination’s links.

url = {
  queryStrings: {
    // Key value pairs
    key: value,
  },
  fragment: string, // Target id
};

To modify the value based on the page link being rendered, add the object modifiers ::offset or ::match to a key in the queryStrings object.

::offset counts up with the given value starting from the second page link.

url = {
  queryStrings: {
    'index::offset': 100,
  },
};

Using ::match on the current page link being rendered, multiplies it by the value provided.

url = {
  queryStrings: {
    'page::match': 1,
  },
};

Using either ::offset or ::match, allows a number to be injected into a string. Using {{#}}, the modifier will inject the modified number based on the counting method into the string when rendering.

url = {
  queryStrings: {
    'index::offset': 'index_{{100}}',
    'page::match': 'page_{{1}}',
  },
};

Get your code

Generate an instance of the component you need by selecting its code properties.

  1. Explore by choosing different code values to generate the instance you want.

  2. Get the code and pull it into your environment.

  3. Add any copy you need to the component (like text for a label).

Note: The code builder uses English for all code elements, which follows standard practice.

Help us improve

Have questions or a request? Give feedback on our contact form.

Something's wrong? Raise it through GitHub with an account. You'll have access to the team's direct responses, progress made on your issue, and issues raised by others.

Give feedback Report an issue on GitHub
2024-07-15