Skip to content
Español

Navigate

Type to search. Press Escape to close.

    Components · css

    Pagination

    Navigation between pages of results. Every page is a real link; the current one carries aria-current="page". Unavailable previous/next controls are plain text with aria-disabled="true", not links.

    CSS: css/components/pagination.css (in ivolt.css).

    Pages of resultsfixtures/pagination/basic.htmlOpen alone — Pages of results
    <section id="top" class="iv-stack iv-u-gap-6">
      <nav class="iv-pagination" aria-label="Pagination">
        <ul class="iv-pagination__list">
          <li><span class="iv-pagination__link" aria-disabled="true">Previous</span></li>
          <li><a class="iv-pagination__link" href="#top" aria-current="page" aria-label="Page 1, current page">1</a></li>
          <li><a class="iv-pagination__link" href="#top" aria-label="Page 2">2</a></li>
          <li><a class="iv-pagination__link" href="#top" aria-label="Page 3">3</a></li>
          <li><span class="iv-pagination__ellipsis" aria-hidden="true">…</span></li>
          <li><a class="iv-pagination__link" href="#top" aria-label="Page 24">24</a></li>
          <li><a class="iv-pagination__link" href="#top" aria-label="Next page">Next</a></li>
        </ul>
      </nav>
    
      <nav class="iv-pagination" aria-label="Pagination, last page">
        <ul class="iv-pagination__list">
          <li><a class="iv-pagination__link" href="#top" aria-label="Previous page">Previous</a></li>
          <li><a class="iv-pagination__link" href="#top" aria-label="Page 23">23</a></li>
          <li><a class="iv-pagination__link" href="#top" aria-current="page" aria-label="Page 24, current page">24</a></li>
          <li><span class="iv-pagination__link" aria-disabled="true">Next</span></li>
        </ul>
      </nav>
    
      <p class="iv-u-m-0 iv-u-text-sm">
        Every page link points back to this section: the fixture demonstrates the
        states, not a real archive. A previous or next step with no destination is a
        <code>&lt;span&gt;</code> with <code>aria-disabled="true"</code>, so it is
        neither focusable nor a link to nowhere.
      </p>
    </section>

    Markup

    nav.iv-pagination[aria-label] → ul.iv-pagination__list → li → a.iv-pagination__link. Ellipsis: span.iv-pagination__ellipsis. Targets are at least 2.5rem.

    Common mistakes

    • Buttons instead of links when each page has a URL.
    • Icon-only previous/next without an accessible name.

    Full example

    Every page number is a link with a real URL, so the list works without JavaScript, can be opened in a new tab and is followed by crawlers. Previous and next say what they do in words, even when an arrow is drawn beside them.

    <nav class="iv-pagination" aria-label="Results pages">
      <ul class="iv-pagination__list">
        <li><span class="iv-pagination__link" aria-disabled="true">Previous</span></li>
        <li><a class="iv-pagination__link" href="?page=1" aria-current="page">1</a></li>
        <li><a class="iv-pagination__link" href="?page=2">2</a></li>
        <li><span class="iv-pagination__ellipsis" aria-hidden="true">…</span></li>
        <li><a class="iv-pagination__link" href="?page=9">9</a></li>
        <li><a class="iv-pagination__link" href="?page=2">Next</a></li>
      </ul>
    </nav>

    How many links to show

    Show the first and last pages, the current one and one neighbour on each side, with an ellipsis in the gaps: the reader always knows where they are and how far the end is. On a phone, cut the neighbours before you cut previous and next. The list wraps instead of overflowing, and every target keeps at least 2.5rem in both directions.

    Customising

    Locals: --iv-pagination-gap, --iv-pagination-size (the target, 2.5rem by default) and --iv-pagination-radius (a pill, like every action in the brand).

    .iv-pagination { --iv-pagination-radius: var(--iv-radius-sm); }