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
2015-08-06 02:47:45 +02:00
group: components
2014-07-13 09:59:31 +02:00
---
2015-08-21 06:59:39 +02:00
Provide pagination links for your site or app with the multi-page pagination component, or the simpler [pager alternative ](#pager ).
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}
2014-07-13 10:17:50 +02:00
## Default pagination
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 %}
2014-09-18 00:21:31 +02:00
< nav >
< 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
2014-07-13 10:17:50 +02:00
### Disabled and active states
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 %}
2014-09-18 00:21:31 +02:00
< nav >
< 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 %}
2014-09-18 00:21:31 +02:00
< nav >
< 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
2014-07-13 10:17:50 +02:00
### Sizing
Fancy larger or smaller pagination? Add `.pagination-lg` or `.pagination-sm` for additional sizes.
{% example html %}
2014-09-18 00:21:31 +02:00
< nav >
< 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 %}
2014-09-18 00:21:31 +02:00
< nav >
< 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 %}
2014-03-17 03:03:53 +01:00
2014-07-13 10:17:50 +02:00
## Pager
2014-03-17 03:03:53 +01:00
2014-07-13 10:17:50 +02:00
Quick previous and next links for simple pagination implementations with light markup and styles. It's great for simple sites like blogs or magazines.
2014-03-17 03:03:53 +01:00
2014-07-13 10:17:50 +02:00
### Default example
By default, the pager centers links.
{% example html %}
2014-09-18 00:21:31 +02:00
< nav >
< ul class = "pager" >
< li > < a href = "#" > Previous< / a > < / li >
< li > < a href = "#" > Next< / a > < / li >
< / ul >
< / nav >
2014-07-13 10:17:50 +02:00
{% endexample %}
2014-03-17 03:03:53 +01:00
2014-07-13 10:17:50 +02:00
### Aligned links
Alternatively, you can align each link to the sides:
{% example html %}
2014-09-18 00:21:31 +02:00
< nav >
< ul class = "pager" >
2014-12-18 03:36:51 +01:00
< li class = "pager-prev" > < a href = "#" > Older< / a > < / li >
< li class = "pager-next" > < a href = "#" > Newer< / a > < / li >
2014-09-18 00:21:31 +02:00
< / ul >
< / nav >
2014-07-13 10:17:50 +02:00
{% endexample %}
### Optional disabled state
2014-03-17 03:03:53 +01:00
2015-12-26 14:50:18 +01:00
Pager links also support the `.disabled` class (though note that the same advice about keyboard focus as for the default pagination applies here as well).
2014-03-17 03:03:53 +01:00
2015-08-13 06:17:05 +02:00
{% example html %}
2014-09-18 00:21:31 +02:00
< nav >
< ul class = "pager" >
2015-12-26 14:50:18 +01:00
< li class = "pager-prev disabled" > < a href = "#" tabindex = "-1" > Older< / a > < / li >
2014-12-18 03:36:51 +01:00
< li class = "pager-next" > < a href = "#" > Newer< / a > < / li >
2014-09-18 00:21:31 +02:00
< / ul >
< / nav >
2015-08-13 06:17:05 +02:00
{% endexample %}