2014-07-13 09:59:31 +02:00
---
2015-08-15 07:45:55 +02:00
layout: docs
2014-07-13 09:59:31 +02:00
title: Pagination
2016-10-03 03:19:47 +02:00
description: Documentation and examples for showing pagination links.
2015-08-06 02:47:45 +02:00
group: components
2014-07-13 09:59:31 +02:00
---
2016-01-11 09:47:36 +01:00
Provide pagination links for your site or app with the multi-page pagination component.
2014-07-13 10:17:50 +02:00
2015-05-29 10:58:52 +02:00
## Contents
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
2016-01-06 23:47:33 +01:00
## Overview
2014-07-13 10:17:50 +02:00
Simple pagination inspired by Rdio, great for apps and search results. The large block is hard to miss, easily scalable, and provides large click areas.
{% example html %}
2016-04-10 16:01:06 +02:00
< nav aria-label = "Page navigation" >
2014-09-18 00:21:31 +02:00
< ul class = "pagination" >
2015-12-08 07:24:50 +01:00
< li class = "page-item" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" aria-label = "Previous" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > « < / span >
< span class = "sr-only" > Previous< / span >
< / a >
< / li >
2015-12-08 07:24:50 +01:00
< li class = "page-item" > < a class = "page-link" href = "#" > 1< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 2< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 3< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 4< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 5< / a > < / li >
< li class = "page-item" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" aria-label = "Next" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > » < / span >
< span class = "sr-only" > Next< / span >
< / a >
< / li >
2014-09-18 00:21:31 +02:00
< / ul >
< / nav >
2014-07-13 10:17:50 +02:00
{% endexample %}
2014-03-17 03:03:53 +01:00
2016-04-10 16:01:06 +02:00
{% callout info %}
### Labelling the pagination component
The pagination component should be wrapped in a `<nav>` element to identify it as a navigation section to screen readers and other assistive technologies. In addition, as a page is likely to have more than one such navigation section already (such as the primary navigation in the header, or a sidebar navigation), it is advisable to provide a descriptive `aria-label` for the `<nav>` which reflects its purpose. For example, if the pagination component is used to navigate between a set of search results, an appropriate label could be `aria-label="Search results pages"` .
{% endcallout %}
2016-01-06 23:47:33 +01:00
## Disabled and active states
2014-07-13 10:17:50 +02:00
Links are customizable for different circumstances. Use `.disabled` for unclickable links and `.active` to indicate the current page.
2015-12-26 14:50:18 +01:00
{% callout warning %}
#### Link functionality caveat
2015-12-27 00:51:27 +01:00
The `.disabled` class uses `pointer-events: none` to try to disable the link functionality of `<a>` s, but that CSS property is not yet standardized. In addition, even in browsers that do support `pointer-events: none` , keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, add a `tabindex="-1"` attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality.
2015-12-26 14:50:18 +01:00
{% endcallout %}
2014-07-13 10:17:50 +02:00
{% example html %}
2016-04-10 16:01:06 +02:00
< nav aria-label = "..." >
2014-09-18 00:21:31 +02:00
< ul class = "pagination" >
2015-12-08 07:24:50 +01:00
< li class = "page-item disabled" >
2015-12-26 14:50:18 +01:00
< a class = "page-link" href = "#" tabindex = "-1" aria-label = "Previous" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > « < / span >
< span class = "sr-only" > Previous< / span >
< / a >
< / li >
2015-12-08 07:24:50 +01:00
< li class = "page-item active" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" > 1 < span class = "sr-only" > (current)< / span > < / a >
2014-12-01 05:17:45 +01:00
< / li >
2015-12-08 07:24:50 +01:00
< li class = "page-item" > < a class = "page-link" href = "#" > 2< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 3< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 4< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 5< / a > < / li >
< li class = "page-item" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" aria-label = "Next" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > » < / span >
< span class = "sr-only" > Next< / span >
< / a >
< / li >
2014-09-18 00:21:31 +02:00
< / ul >
< / nav >
2014-07-13 10:17:50 +02:00
{% endexample %}
2015-12-26 14:50:18 +01:00
You can optionally swap out active or disabled anchors for `<span>` , or omit the anchor in the case of the prev/next arrows, to remove click functionality and prevent keyboard focus while retaining intended styles.
2014-07-13 10:17:50 +02:00
2015-10-30 06:40:12 +01:00
{% example html %}
2016-04-10 16:01:06 +02:00
< nav aria-label = "..." >
2014-09-18 00:21:31 +02:00
< ul class = "pagination" >
2015-12-08 07:24:50 +01:00
< li class = "page-item disabled" >
2015-10-30 06:03:06 +01:00
< span class = "page-link" aria-label = "Previous" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > « < / span >
< span class = "sr-only" > Previous< / span >
< / span >
< / li >
2015-12-08 07:24:50 +01:00
< li class = "page-item active" > < span class = "page-link" > 1 < span class = "sr-only" > (current)< / span > < / span > < / li >
2014-09-18 00:21:31 +02:00
< / ul >
< / nav >
2015-10-30 06:40:12 +01:00
{% endexample %}
2014-03-17 03:03:53 +01:00
2016-01-06 23:47:33 +01:00
## Sizing
2014-07-13 10:17:50 +02:00
Fancy larger or smaller pagination? Add `.pagination-lg` or `.pagination-sm` for additional sizes.
{% example html %}
2016-04-10 16:01:06 +02:00
< nav aria-label = "..." >
2014-09-18 00:21:31 +02:00
< ul class = "pagination pagination-lg" >
2015-12-08 07:24:50 +01:00
< li class = "page-item" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" aria-label = "Previous" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > « < / span >
< span class = "sr-only" > Previous< / span >
< / a >
< / li >
2015-12-08 07:24:50 +01:00
< li class = "page-item" > < a class = "page-link" href = "#" > 1< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 2< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 3< / a > < / li >
< li class = "page-item" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" aria-label = "Next" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > » < / span >
< span class = "sr-only" > Next< / span >
< / a >
< / li >
2014-09-18 00:21:31 +02:00
< / ul >
< / nav >
2014-07-13 10:17:50 +02:00
{% endexample %}
{% example html %}
2016-04-10 16:01:06 +02:00
< nav aria-label = "..." >
2014-09-18 00:21:31 +02:00
< ul class = "pagination pagination-sm" >
2015-12-08 07:24:50 +01:00
< li class = "page-item" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" aria-label = "Previous" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > « < / span >
< span class = "sr-only" > Previous< / span >
< / a >
< / li >
2015-12-08 07:24:50 +01:00
< li class = "page-item" > < a class = "page-link" href = "#" > 1< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 2< / a > < / li >
< li class = "page-item" > < a class = "page-link" href = "#" > 3< / a > < / li >
< li class = "page-item" >
2015-10-30 06:03:06 +01:00
< a class = "page-link" href = "#" aria-label = "Next" >
2014-12-01 05:17:45 +01:00
< span aria-hidden = "true" > » < / span >
< span class = "sr-only" > Next< / span >
< / a >
< / li >
2014-09-18 00:21:31 +02:00
< / ul >
< / nav >
2014-07-13 10:17:50 +02:00
{% endexample %}