QdsPagination

Page navigation and page-size control for qds-data-table, usable standalone under any paged list.

Overview

The qds-pagination component provides page navigation (first, previous, numbered pages, next, last) and a page-size selector. It is designed to sit below a qds-data-table or any paged collection. It is a navigation control, not a form-associated input.

Usage

<qds-pagination
  page="1"
  page-size="25"
  total="1284"
></qds-pagination>
const pagination = document.querySelector('qds-pagination');
pagination.addEventListener('qds-page-change', (e) => {
  const { page, pageSize, total } = e.detail;
  // Refetch data with the new page and page size
  fetchData({ page, pageSize });
});

API Reference

Attributes

Properties

CSS Parts

CSS Custom Properties

Events

Page-size change rule

Changing the page size keeps the first visible item in view rather than keeping the page number. Going from page 3 at 25 items per page (item 51) to 50 items per page lands on page 2 (items 51-100), not page 3 (items 101-150). Users read page size as “show me more of what I am looking at.”

Single-event decision

One event (qds-page-change) fires for both page and page-size changes. A consumer refetching data needs page and size together, and two events means two fetches. The detail always carries both page and pageSize, whichever changed.

No event fires when a click resolves to the current page, or when page is set programmatically. Programmatic changes are the consumer’s own state, and echoing them back causes update loops.

Keyboard

Key Behaviour
Tab Each control is its own tab stop; the number strip is not a single stop
Enter / Space Activates the focused button
ArrowLeft / ArrowRight Moves focus between page buttons without activating

Example

<qds-pagination
  id="pager"
  page="1"
  page-size="25"
  total="1284"
  page-size-options="10,25,50,100"
></qds-pagination>

<script>
  const pager = document.getElementById('pager');
  pager.addEventListener('qds-page-change', (e) => {
    console.log('Page:', e.detail.page, 'Size:', e.detail.pageSize);
  });
</script>