Skip to content
Indiana University Logo
Rivet Design System
  • Components Add-ons Content guide Migration guide
  • What is Rivet? Blog Changelog
  1. May 4, 2022

    Rivet 2.0.0-beta.4 release

    The fourth Rivet 2 beta release introduces design updates to several components and a new responsive table wrapper element.

  2. March 30, 2022

    Rivet 2.0.0-beta.3 release

    The third Rivet 2 beta release updates accordion, badge, and button styles.

  3. February 9, 2022

    Rivet 2.0.0-beta.2 release

    The latest Rivet 2 beta release introduces the link hub component, adds new utility classes, and refactors component JavaScript.

More posts Get updates in your inbox
Install via NPM Download CSS & JS Hosted assets
Navigation
    • Components
    • Add-ons
    • Content guide
    • What is Rivet?
    • Blog
    • Roadmap
    • Changelog
  • Use Rivet
Resources
  • User Experience Office
  • Accessibility Evaluations
  • Rivet Software Design System
  • IU Framework for WCMS
Rivet 1 has been retired and will no longer receive updates. The v1 source code has been archived here. Please migrate to Rivet 2 as soon as possible.
Version 1.8.3
  • Information
    • Changelog
    • Component status
    • Contributing
  • Getting started
    • Install with NPM
    • Rivet Sass
  • Layout
    • Box
    • Grid
    • Panels
    • Spacing
    • Typography
  • Page content
    • Badges
    • Links
    • Lists
    • Media Object
    • Step Indicator
    • Tables
    • Tabs This component requires JS
    • Timeline
  • Forms
    • Buttons
    • Segmented Buttons
    • Checkboxes
    • File input This component requires JS
    • Input group
    • Radio buttons
    • Select element
    • Text inputs
  • Navigation
    • Breadcrumb
    • Dropdown This component requires JS
    • Footer
    • Header This component requires JS
    • Menu
    • Pagination
  • Overlays & Feedback
    • Alerts This component requires JS
    • Loading indicator
    • Modals This component requires JS
  • Utilities
    • Border
    • Display
    • Flex
    • Text
    • Visibility
    • Width
    • z-index
Ready Added in 1.0.0

Pagination

The pagination component is used to break up large sets of data across multiple pages.

Migrating to Rivet 2

This version of Rivet is deprecated. View the pagination documentation on the Rivet 2 website.

Basic pagination example

A basic pagination component uses an unordered list wrapped in a nav element to let users move between pages in a set of data. Use basic pagination like the following example when you will only ever have five or fewer pages of data to show.

  • 1
  • 2
  • 3
  • 4
  • 5
<nav role="navigation" aria-label="Pagination">
  <ul class="rvt-pagination">
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 1">1</a>
    </li>
    <li class="rvt-pagination__item is-active">
      <a href="#" aria-current="true" aria-label="Page 2, current page">2</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 3">3</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 4">4</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 5">5</a>
    </li>
  </ul>
</nav>

Large data sets

When you need to paginate large sets of data over many pages, use a modified pagination component shown in the following example.

  • Use the ellipsis icons to help visually indicate that there are more sets of pages before and/or after the currently displayed set. Note in this example we use the tabindex aria-hidden attributes to remove the ellipsis from the tab order and hide the content from screen readers
  • Make the first and last page in the set available so that users can navigate to those pages no matter when group of pages are currently shown.
  • Make the first item a link with the text Previous that navigates to the page directly before the current page once a user has navigated through the first set of visible pages
  • Make the last item a link with the text Next that navigates to the page directly after the current page once a user has navigated through the first set of visible pages

Default state for large data sets

In the default state, the pagination shows the first four pages with a link to the last page. We use an ellipsis icon to visually indicate that the list of pages is truncated and that there are more pages available.

  • 1
  • 2
  • 3
  • 4
  • 20
<nav role="navigation" aria-label="Large pagination">
  <ul class="rvt-pagination rvt-pagination">
    <li class="rvt-pagination__item is-active">
      <a href="#" aria-current="page" aria-label="Page 1, current page">1</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 2">2</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 3">3</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 4">4</a>
    </li>
    <li class="rvt-pagination__item is-disabled">
      <a href="#" class="rvt-flex" tabindex="-1" aria-hidden="true">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
          <g fill="currentColor">
            <circle cx="8" cy="8" r="2"></circle>
            <circle cx="14" cy="8" r="2"></circle>
            <circle cx="2" cy="8" r="2"></circle>
          </g>
        </svg>
      </a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 20, last page">20</a>
    </li>
  </ul>
</nav>

Advanced state

This examples shows the pagination component once a user has navigated to a set of pages where the first, last, previous, and next page links are available.

  • Previous
  • 1
  • 6
  • 7
  • 8
  • 9
  • 20
  • Next
<nav role="navigation" aria-label="Advanced pagination">
  <ul class="rvt-pagination">
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Previous page">Previous</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 1">1</a>
    </li>
    <li class="rvt-pagination__item is-disabled">
      <a href="#" class="rvt-flex" tabindex="-1" aria-hidden="true">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
          <g fill="currentColor">
            <circle cx="8" cy="8" r="2"></circle>
            <circle cx="14" cy="8" r="2"></circle>
            <circle cx="2" cy="8" r="2"></circle>
          </g>
        </svg>
      </a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 6">6</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 7">7</a>
    </li>
    <li class="rvt-pagination__item is-active" aria-current="true">
      <a href="#" aria-label="Page 8, current page">8</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 9">9</a>
    </li>
    <li class="rvt-pagination__item is-disabled">
      <a href="#" class="rvt-flex" tabindex="-1" aria-hidden="true">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
          <g fill="currentColor">
            <circle cx="8" cy="8" r="2"></circle>
            <circle cx="14" cy="8" r="2"></circle>
            <circle cx="2" cy="8" r="2"></circle>
          </g>
        </svg>
      </a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 20, last page">20</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Next set of pages">Next</a>
    </li>
  </ul>
</nav>

When to use

Use when a user’s action returns a large data set such as search results, or a large number of rows in a data table to break results into multiple pages to help with load times.

When to consider something else

With smaller amounts of data consider displaying the whole data set in one page that users can scroll through instead of breaking it into pages.

Accessibility

The pagination component is wrapped in a nav element so that it is announced to assistive technologies. Use an aria-label attribute to describe the purpose of your pagination. This will help assistive technologies distinguish between navigation sections on pages that use more than one nav element.

Accessible dynamic pagination

This article on a11ymatters.com has some really good tips on implementing dynamic aria-label(s) on pagination items based on how many pages are returned.

Implementation

When using the .is-disabled classes to create pagination links that appear to be disabled, add a tabindex="-1" attribute to the a tag so that it removes the disabled link from the tab order. It’s also advisable to use JavaScript to disable the link’s default functionality with the preventDefault() method.

Positioning

The pagination component is left-aligned by default, but you can easily center or right-align it using the .rvt-pagination--center or .rvt-pagination--right modifier classes.

  • 1
  • 2
  • 3
  • 4
  • 20
<nav role="navigation" aria-label="Right-aligned pagination">
  <ul class="rvt-pagination rvt-pagination--right">
    <li class="rvt-pagination__item is-active">
      <a href="#" aria-current="page" aria-label="Page 1, current page">1</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 2">2</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 3">3</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 4">4</a>
    </li>
    <li class="rvt-pagination__item is-disabled">
      <a href="#" class="rvt-flex" tabindex="-1" aria-hidden="true">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
          <g fill="currentColor">
            <circle cx="8" cy="8" r="2"></circle>
            <circle cx="14" cy="8" r="2"></circle>
            <circle cx="2" cy="8" r="2"></circle>
          </g>
        </svg>
      </a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 20, last page">20</a>
    </li>
  </ul>
</nav>

Small pagination

Add the CSS modifier class .rvt-pagination--small if you need to display the pagination component at a smaller size.

  • 1
  • 2
  • 3
  • 4
  • 20
<nav role="navigation" aria-label="Small pagination">
  <ul class="rvt-pagination rvt-pagination--small">
    <li class="rvt-pagination__item is-active">
      <a href="#" aria-current="page" aria-label="Page 1, current page">1</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 2">2</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 3">3</a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 4">4</a>
    </li>
    <li class="rvt-pagination__item is-disabled">
      <a href="#" class="rvt-flex" tabindex="-1" aria-hidden="true">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
          <g fill="currentColor">
            <circle cx="8" cy="8" r="2"></circle>
            <circle cx="14" cy="8" r="2"></circle>
            <circle cx="2" cy="8" r="2"></circle>
          </g>
        </svg>
      </a>
    </li>
    <li class="rvt-pagination__item">
      <a href="#" aria-label="Page 20, last page">20</a>
    </li>
  </ul>
</nav>

On this page

  • Basic pagination example
  • Large data sets
    • Default state for large data sets
    • Advanced state
  • When to use
  • When to consider something else
  • Accessibility
    • Accessible dynamic pagination
  • Implementation
    • Positioning
    • Small pagination
  • Accessibility
  • Privacy Notice
  • Copyright © The Trustees of Indiana University