71eeb0f9caea6dc7e2294b95b9b40e22c0e4f582.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. ---
  2. layout: docs
  3. title: Pagination
  4. group: components
  5. ---
  6. Provide pagination links for your site or app with the multi-page pagination component, or the simpler [pager alternative](#pagination-pager).
  7. ## Contents
  8. * Will be replaced with the ToC, excluding the "Contents" header
  9. {:toc}
  10. ## Default pagination
  11. 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.
  12. {% example html %}
  13. <nav>
  14. <ul class="pagination">
  15. <li>
  16. <a href="javascript:;" aria-label="Previous">
  17. <span aria-hidden="true">&laquo;</span>
  18. <span class="sr-only">Previous</span>
  19. </a>
  20. </li>
  21. <li><a href="javascript:;">1</a></li>
  22. <li><a href="javascript:;">2</a></li>
  23. <li><a href="javascript:;">3</a></li>
  24. <li><a href="javascript:;">4</a></li>
  25. <li><a href="javascript:;">5</a></li>
  26. <li>
  27. <a href="javascript:;" aria-label="Next">
  28. <span aria-hidden="true">&raquo;</span>
  29. <span class="sr-only">Next</span>
  30. </a>
  31. </li>
  32. </ul>
  33. </nav>
  34. {% endexample %}
  35. ### Disabled and active states
  36. Links are customizable for different circumstances. Use `.disabled` for unclickable links and `.active` to indicate the current page.
  37. {% example html %}
  38. <nav>
  39. <ul class="pagination">
  40. <li class="disabled">
  41. <a href="javascript:;" aria-label="Previous">
  42. <span aria-hidden="true">&laquo;</span>
  43. <span class="sr-only">Previous</span>
  44. </a>
  45. </li>
  46. <li class="active">
  47. <a href="javascript:;">1 <span class="sr-only">(current)</span></a>
  48. </li>
  49. <li><a href="javascript:;">2</a></li>
  50. <li><a href="javascript:;">3</a></li>
  51. <li><a href="javascript:;">4</a></li>
  52. <li><a href="javascript:;">5</a></li>
  53. <li>
  54. <a href="javascript:;" aria-label="Next">
  55. <span aria-hidden="true">&raquo;</span>
  56. <span class="sr-only">Next</span>
  57. </a>
  58. </li>
  59. </ul>
  60. </nav>
  61. {% endexample %}
  62. 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 while retaining intended styles.
  63. {% highlight html %}
  64. <nav>
  65. <ul class="pagination">
  66. <li class="disabled">
  67. <span aria-label="Previous">
  68. <span aria-hidden="true">&laquo;</span>
  69. <span class="sr-only">Previous</span>
  70. </span>
  71. </li>
  72. <li class="active"><span>1 <span class="sr-only">(current)</span></span></li>
  73. </ul>
  74. </nav>
  75. {% endhighlight %}
  76. ### Sizing
  77. Fancy larger or smaller pagination? Add `.pagination-lg` or `.pagination-sm` for additional sizes.
  78. {% example html %}
  79. <nav>
  80. <ul class="pagination pagination-lg">
  81. <li>
  82. <a href="javascript:;" aria-label="Previous">
  83. <span aria-hidden="true">&laquo;</span>
  84. <span class="sr-only">Previous</span>
  85. </a>
  86. </li>
  87. <li><a href="javascript:;">1</a></li>
  88. <li><a href="javascript:;">2</a></li>
  89. <li><a href="javascript:;">3</a></li>
  90. <li>
  91. <a href="javascript:;" aria-label="Next">
  92. <span aria-hidden="true">&raquo;</span>
  93. <span class="sr-only">Next</span>
  94. </a>
  95. </li>
  96. </ul>
  97. </nav>
  98. {% endexample %}
  99. {% example html %}
  100. <nav>
  101. <ul class="pagination pagination-sm">
  102. <li>
  103. <a href="javascript:;" aria-label="Previous">
  104. <span aria-hidden="true">&laquo;</span>
  105. <span class="sr-only">Previous</span>
  106. </a>
  107. </li>
  108. <li><a href="javascript:;">1</a></li>
  109. <li><a href="javascript:;">2</a></li>
  110. <li><a href="javascript:;">3</a></li>
  111. <li>
  112. <a href="javascript:;" aria-label="Next">
  113. <span aria-hidden="true">&raquo;</span>
  114. <span class="sr-only">Next</span>
  115. </a>
  116. </li>
  117. </ul>
  118. </nav>
  119. {% endexample %}
  120. ## Pager
  121. Quick previous and next links for simple pagination implementations with light markup and styles. It's great for simple sites like blogs or magazines.
  122. ### Default example
  123. By default, the pager centers links.
  124. {% example html %}
  125. <nav>
  126. <ul class="pager">
  127. <li><a href="javascript:;">Previous</a></li>
  128. <li><a href="javascript:;">Next</a></li>
  129. </ul>
  130. </nav>
  131. {% endexample %}
  132. ### Aligned links
  133. Alternatively, you can align each link to the sides:
  134. {% example html %}
  135. <nav>
  136. <ul class="pager">
  137. <li class="pager-prev"><a href="javascript:;">Older</a></li>
  138. <li class="pager-next"><a href="javascript:;">Newer</a></li>
  139. </ul>
  140. </nav>
  141. {% endexample %}
  142. ### Optional disabled state
  143. Pager links also use the `.disabled` class.
  144. {% example html %}
  145. <nav>
  146. <ul class="pager">
  147. <li class="pager-prev disabled"><a href="javascript:;">Older</a></li>
  148. <li class="pager-next"><a href="javascript:;">Newer</a></li>
  149. </ul>
  150. </nav>
  151. {% endexample %}