# Pagination

> Pagination splits a long list or table into pages and lets the user move between them, with sizes, icons and disabled states.

Navigate through multi-page content with pagination controls.

Source: https://docs.tabler.io/ui/components/pagination

---

## Basic example

The basic pagination has page numbers with previous and next icon links:

```html
<!-- BEGIN PAGINATION -->
<nav aria-label="Pagination">
  <ul class="pagination">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1" aria-disabled="true" aria-label="Previous page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-left -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M15 6l-6 6l6 6" />
        </svg>
      </a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 1">1</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 2">2</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="#" aria-label="Page 3" aria-current="page">3</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 4">4</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 5">5</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Next page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-right -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M9 6l6 6l-6 6" />
        </svg>
      </a>
    </li>
  </ul>
</nav>
<!-- END PAGINATION -->
```

## With first and last links

With many pages, add first and last links to jump to either end.

```html
<!-- BEGIN PAGINATION -->
<nav aria-label="Pagination">
  <ul class="pagination">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1" aria-disabled="true" aria-label="First page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevrons-left -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M11 7l-5 5l5 5" />
          <path d="M17 7l-5 5l5 5" />
        </svg>
      </a>
    </li>
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1" aria-disabled="true" aria-label="Previous page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-left -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M15 6l-6 6l6 6" />
        </svg>
      </a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 1">1</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 2">2</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="#" aria-label="Page 3" aria-current="page">3</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 4">4</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 5">5</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Next page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-right -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M9 6l6 6l-6 6" />
        </svg>
      </a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Last page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevrons-right -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M7 7l5 5l-5 5" />
          <path d="M13 7l5 5l-5 5" />
        </svg>
      </a>
    </li>
  </ul>
</nav>
<!-- END PAGINATION -->
```

## Offset

When there are too many pages to list, show only a few around the current one.

```html
<!-- BEGIN PAGINATION -->
<nav aria-label="Pagination">
  <ul class="pagination">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1" aria-disabled="true" aria-label="Previous page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-left -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M15 6l-6 6l6 6" />
        </svg>
      </a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 1">1</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 2">2</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="#" aria-label="Page 3" aria-current="page">3</a>
    </li>
    <li class="page-item">
      <span class="page-link disabled">&hellip;</span>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 18">18</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 19">19</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 20">20</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Next page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-right -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M9 6l6 6l-6 6" />
        </svg>
      </a>
    </li>
  </ul>
</nav>
<!-- END PAGINATION -->
```

## Button with text

Text buttons give the previous and next links a label instead of an icon.

```html
<!-- BEGIN PAGINATION -->
<nav aria-label="Pagination">
  <ul class="pagination">
    <li class="page-item disabled">
      <a class="page-link page-text" href="#" tabindex="-1" aria-disabled="true">Previous</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 1">1</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 2">2</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="#" aria-label="Page 3" aria-current="page">3</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 4">4</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 5">5</a>
    </li>
    <li class="page-item">
      <a class="page-link page-text" href="#">Next</a>
    </li>
  </ul>
</nav>
<!-- END PAGINATION -->
```

## Outline version

The `.pagination-outline` class draws the items with a border and no fill.

```html
<!-- BEGIN PAGINATION -->
<nav aria-label="Pagination">
  <ul class="pagination pagination-outline">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1" aria-disabled="true" aria-label="Previous page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-left -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M15 6l-6 6l6 6" />
        </svg>
      </a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 1">1</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 2">2</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="#" aria-label="Page 3" aria-current="page">3</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 4">4</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 5">5</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Next page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-right -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M9 6l6 6l-6 6" />
        </svg>
      </a>
    </li>
  </ul>
</nav>
<!-- END PAGINATION -->
```

## Circle version

The `.pagination-circle` class makes each item round. It combines with `.pagination-outline`.

```html
<!-- BEGIN PAGINATION -->
<nav aria-label="Pagination">
  <ul class="pagination pagination-circle">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1" aria-disabled="true" aria-label="Previous page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-left -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M15 6l-6 6l6 6" />
        </svg>
      </a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 1">1</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 2">2</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="#" aria-label="Page 3" aria-current="page">3</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 4">4</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 5">5</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Next page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-right -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M9 6l6 6l-6 6" />
        </svg>
      </a>
    </li>
  </ul>
</nav>
<!-- END PAGINATION -->
<!-- BEGIN PAGINATION -->
<nav aria-label="Pagination">
  <ul class="pagination pagination-circle pagination-outline">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1" aria-disabled="true" aria-label="Previous page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-left -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M15 6l-6 6l6 6" />
        </svg>
      </a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 1">1</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 2">2</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="#" aria-label="Page 3" aria-current="page">3</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 4">4</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Page 5">5</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Next page">
        <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-right -->
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="icon">
          <path d="M9 6l6 6l-6 6" />
        </svg>
      </a>
    </li>
  </ul>
</nav>
<!-- END PAGINATION -->
```

## Pager with page names

For prose - documentation, a blog, a wizard - name the pages instead of numbering them. Put `page-item-subtitle` above the title for the direction, and `page-item-title` for the name of the target page.

```html
<nav aria-label="Pagination">
  <ul class="pagination">
    <li class="page-item page-prev">
      <a class="page-link" href="#" rel="prev">
        <div class="page-item-subtitle">previous</div>
        <div class="page-item-title">Getting started</div>
      </a>
    </li>
    <li class="page-item page-next">
      <a class="page-link" href="#" rel="next">
        <div class="page-item-subtitle">next</div>
        <div class="page-item-title">Installation</div>
      </a>
    </li>
  </ul>
</nav>
```

## Accessibility

- Wrap the list in `<nav aria-label="Pagination">`. A page can have more than one pager, so the label is what tells them apart.
- Mark the current page with `aria-current="page"` on its link, not with the `active` class alone.
- Previous and next arrows need text. Keep a `visually-hidden` label, or set `aria-label="Previous"` on the link.
- A disabled step is still a link. Add `aria-disabled="true"` and `tabindex="-1"` so it is skipped, since the `disabled` class only changes how it looks.
- The page numbers alone do not say what they page through. Say it in the `nav` label, for example `aria-label="Search results pages"`.
