# Pagination

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FxtgrUz8xPHj0RXQRNMpQ%2FFrame%2045.png?alt=media&#x26;token=8989de4d-94f3-486e-b25a-2f1aee96025e" alt=""><figcaption></figcaption></figure>

## Overview

Pagination helps users manage large amounts of data by splitting it into manageable sections, allowing smooth navigation between content pages.

{% embed url="<https://www.figma.com/design/4NwKhd4dwRhRF5Zpiooi69/Components?node-id=2-231280&t=0Thv0LIO2gFzE3eo-4>" %}

## When to use

* Use pagination when the data set is too large to display on one screen, such as in a product listing or database results.&#x20;
* Pagination is ideal when users need to navigate through long lists, tables, or collections without overwhelming them with all data at once.&#x20;
* Use pagination in blogs or news websites where multiple articles are organized into pages for better readability and access.&#x20;
* When displaying search results, pagination allows users to browse results in chunks without loading the entire dataset.

## When not to use

* Avoid pagination when there is only a small amount of content, as it adds unnecessary navigation steps.&#x20;
* Do not use pagination in interfaces where continuous scrolling is more appropriate, such as social media feeds.&#x20;
* If users only need to browse a few items quickly, pagination can hinder the experience by requiring extra clicks.&#x20;
* Pagination is not ideal if users need to access non-sequential sections frequently; in this case, consider a more flexible navigation option.&#x20;
* Do not use pagination if users need to see all items at once for comparison or decision-making purposes.

## Types

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2Ft6LQWj8tLPVHDRLfa32w%2FTypes.png?alt=media&#x26;token=aa3a8284-8ebc-4eff-9bfb-8c43943a3356" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="164">Type</th><th>Description</th></tr></thead><tbody><tr><td>Numbers</td><td>A numbered system for navigating between content sections.</td></tr><tr><td>Simple</td><td>Basic pagination ideal for quick, minimal navigation on smaller screens.</td></tr><tr><td>Advance</td><td>More complex pagination system, providing multiple navigation options.</td></tr></tbody></table>

## Anatomy

#### Advanced Variant

1. **Page Number Menu:** A list of clickable page numbers that allow users to jump directly to a specific page.&#x20;
2. **Viewing Range:** Displays the number of items being viewed out of the total number of items.&#x20;
3. **Container:** The structure that holds all pagination elements.&#x20;
4. **Active Page:** The current page number is highlighted to indicate the user’s current position.&#x20;
5. **Previous and Next Buttons:** Controls for moving sequentially through the pages.

#### Numbers Variant

1. **Previous and Next Buttons:** Navigation controls to move forward or backward through the pages.&#x20;
2. **Selected Page:** The specific page a user is currently viewing.&#x20;
3. **Page Number Menu (icon only):** Indicates additional pages not shown, accessible by expanding the 3-dot icon.

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FQwg6DLmXfPwZZZp567Jw%2FAnatomy.png?alt=media&#x26;token=db71e166-af0a-498c-bee8-c8a5f9f2ffc1" alt=""><figcaption></figcaption></figure>

## Size

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2Fhtgn8TypOjnuVX0NJLup%2FSize.png?alt=media&#x26;token=3761a4ea-820e-4874-9fcd-a9641bb38408" alt=""><figcaption></figcaption></figure>

| Size   | Number Button (px) | Text and number (px) | Icon (px) | Container Height (px) |
| ------ | ------------------ | -------------------- | --------- | --------------------- |
| Small  | 14                 | 12                   | 16        | 32                    |
| Medium | 16                 | 14                   | 20        | 40                    |
| Large  | 18                 | 16                   | 24        | 48                    |

## Accessibility

* **Keyboard Navigation:** Pagination should be navigable using keyboard controls, such as arrow keys, tabbing between buttons, or number shortcuts.&#x20;
* **Screen Reader Compatibility:** Ensure that each page control is labeled clearly for screen readers, so users know which page they are on and how to move between them.&#x20;
* **Visible Focus State:** Make sure pagination controls have a visible focus state when navigated with a keyboard to ensure accessibility for users with disabilities.&#x20;
* **Responsive Design:** Pagination should adapt to different screen sizes, providing easy navigation on both mobile and desktop interfaces.&#x20;
* **Large Click/Tap Targets:** Make sure that buttons for navigation, such as "Next" and "Previous," are large enough to click or tap easily on both desktop and mobile.

## Example

* **E-commerce Product Listings:** Paginate product listings to make it easier for customers to browse through large catalogs without loading all items at once.&#x20;
* **Blog Article Listings:** On a blog website, pagination helps divide articles into pages, improving both the browsing experience and load time.&#x20;
* **Search Results Pages:** Pagination is often used to present search results, allowing users to scroll through options without overwhelming them with all results at once.&#x20;
* **Data Tables in Dashboards:** In enterprise applications, pagination helps break down large tables of data, such as sales figures or customer data, into manageable sections.&#x20;
* **News Websites:** Paginating articles on news websites ensures readers can browse through content quickly and intuitively, without slowing down the page load.
