Newer
Older
vmk-demo-bot / admin / template / src / pug / views / base / pagination.pug
extends ../../_layout/default.pug

block canonical
  link(rel='canonical' href='https://coreui.io/docs/components/pagination/')

block breadcrumb
  +breadcrumb(
    [
      { href: '#', label: 'Home'},
      { label: 'Components'},
      { label: 'Base'},
      'Pagination'
    ],
  )

block view
  +docs-components('https://coreui.io/docs/components/pagination/')
  .row
    .col-12
      .card.mb-4
        .card-header
          strong Pagination
          span.small.ms-1 Overview
        .card-body
          p.text-body-secondary.small
            | We use a large block of connected links for our pagination, making links hard to miss and easily scalable—all while providing large hit areas. Pagination is built with list HTML elements so screen readers can announce the number of available links. Use a wrapping 
            code 
              = '<nav>'
            |  element to identify it as a navigation section to screen readers and other assistive technologies.
          p.text-body-secondary.small
            | In addition, as pages likely have more than one such navigation section, it’s advisable to provide a descriptive 
            code aria-label
            |  for the 
            code 
              = '<nav>'
            |  to reflect its purpose. For example, if the pagination component is used to navigate between a set of search results, an appropriate label could be 
            code aria-label="Search results pages"
            | .
          +example('https://coreui.io/docs/components/pagination/#overview')
            nav(aria-label='Page navigation example')
              ul.pagination
                li.page-item
                  a.page-link(href='#') Previous
                li.page-item
                  a.page-link(href='#') 1
                li.page-item
                  a.page-link(href='#') 2
                li.page-item
                  a.page-link(href='#') 3
                li.page-item
                  a.page-link(href='#') Next
    .col-12
      .card.mb-4
        .card-header
          strong Pagination
          span.small.ms-1 Working with icons
        .card-body
          p.text-body-secondary.small
            | Looking to use an icon or symbol in place of text for some pagination links? Be sure to provide proper screen reader support with 
            code aria
            |  attributes.
          +example('https://coreui.io/docs/components/pagination/#working-with-icons')
            nav(aria-label='Page navigation example')
              ul.pagination
                li.page-item
                  a.page-link(href='#' aria-label='Previous')
                    span(aria-hidden='true') «
                li.page-item
                  a.page-link(href='#') 1
                li.page-item
                  a.page-link(href='#') 2
                li.page-item
                  a.page-link(href='#') 3
                li.page-item
                  a.page-link(href='#' aria-label='Next')
                    span(aria-hidden='true') »
    .col-12
      .card.mb-4
        .card-header
          strong Pagination
          span.small.ms-1 Disabled and active states
        .card-body
          p.text-body-secondary.small
            | Pagination links are customizable for different circumstances. Use 
            code .disabled
            |  for links that appear un-clickable and 
            code .active
            |  to indicate the current page.
          p.text-body-secondary.small
            | While the 
            code .disabled
            |  class uses 
            code pointer-events: none
            |  to 
            em try
            |  to disable the link functionality of 
            code 
              = '<a>'
            | s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add 
            code tabindex="-1"
            |  on disabled links and use custom JavaScript to fully disable their functionality.
          +example('https://coreui.io/docs/components/pagination/#disabled-and-active-states')
            nav(aria-label='...')
              ul.pagination
                li.page-item.disabled
                  a.page-link(href='#' tabindex='-1' aria-disabled='true') Previous
                li.page-item
                  a.page-link(href='#') 1
                li.page-item.active(aria-current='page')
                  a.page-link(href='#') 2
                li.page-item
                  a.page-link(href='#') 3
                li.page-item
                  a.page-link(href='#') Next
          p.text-body-secondary.small
            | You can optionally swap out active or disabled anchors for 
            code 
              = '<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.
          +example('https://coreui.io/docs/components/pagination/#disabled-and-active-states')
            nav(aria-label='...')
              ul.pagination
                li.page-item.disabled
                  span.page-link Previous
                li.page-item
                  a.page-link(href='#') 1
                li.page-item.active(aria-current='page')
                  span.page-link 2
                li.page-item
                  a.page-link(href='#') 3
                li.page-item
                  a.page-link(href='#') Next
    .col-12
      .card.mb-4
        .card-header
          strong Pagination
          span.small.ms-1 Sizing
        .card-body
          p.text-body-secondary.small
            | Fancy larger or smaller pagination? Add 
            code .pagination-lg
            |  or 
            code .pagination-sm
            |  for additional sizes.
          +example('https://coreui.io/docs/components/pagination/#sizing')
            nav(aria-label='...')
              ul.pagination.pagination-lg
                li.page-item.active(aria-current='page')
                  span.page-link 1
                li.page-item
                  a.page-link(href='#') 2
                li.page-item
                  a.page-link(href='#') 3
          +example('https://coreui.io/docs/components/pagination/#sizing')
            nav(aria-label='...')
              ul.pagination.pagination-sm
                li.page-item.active(aria-current='page')
                  span.page-link 1
                li.page-item
                  a.page-link(href='#') 2
                li.page-item
                  a.page-link(href='#') 3
    .col-12
      .card.mb-4
        .card-header
          strong Pagination
          span.small.ms-1 Alignment
        .card-body
          p.text-body-secondary.small
            | Change the alignment of pagination components with 
            a(href='https://coreui.io/docs/utilities/flex/') flexbox utilities
            | .
          +example('https://coreui.io/docs/components/pagination/#alignment')
            nav(aria-label='Page navigation example')
              ul.pagination.justify-content-center
                li.page-item.disabled
                  a.page-link(href='#' tabindex='-1' aria-disabled='true') Previous
                li.page-item
                  a.page-link(href='#') 1
                li.page-item
                  a.page-link(href='#') 2
                li.page-item
                  a.page-link(href='#') 3
                li.page-item
                  a.page-link(href='#') Next
          +example('https://coreui.io/docs/components/pagination/#alignment')
            nav(aria-label='Page navigation example')
              ul.pagination.justify-content-end
                li.page-item.disabled
                  a.page-link(href='#' tabindex='-1' aria-disabled='true') Previous
                li.page-item
                  a.page-link(href='#') 1
                li.page-item
                  a.page-link(href='#') 2
                li.page-item
                  a.page-link(href='#') 3
                li.page-item
                  a.page-link(href='#') Next