Source

Pagination tih a ni

Documentation leh entirnan pagination entir nan a kaihhnawih thupui hrang hrang tarlanna tur chu page tam takah a awm a ni.

A tlangpuiin

Kan pagination atan hian connected link block lian tak kan hmang a, chu chuan link te chu miss harsa leh awlsam taka scalable a siam a ni—chu zawng zawng chu hit area lian tak tak kan pe bawk. Pagination hi list HTML elements hmanga siam a nih avangin screen reader te chuan link awm zat an puang thei a ni. Wrapping <nav>element hmangin reader leh assistive technology dangte screen turin navigation section atan hriat theih a ni.

Chu bâkah, page-te chuan chutiang navigation section pakhat aia tam an neih theih avângin, a thiltum a lantîr theih nân aria-labeldescriptive pêk a ṭha . <nav>Entirnan, pagination component chu search results set hrang hrang inkara kal theihna tura hman a nih chuan, label dik tak chu aria-label="Search results pages".

<nav aria-label="Page navigation example">
  <ul class="pagination">
    <li class="page-item"><a class="page-link" href="#">Previous</a></li>
    <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="#">Next</a></li>
  </ul>
</nav>

Icon hmanga hnathawh

Pagination link thenkhat atan text aiah icon emaw symbol emaw hman i zawng em? ariaAttribute leh .sr-onlyutility te nen screen reader support dik tak pe ngei ang che .

<nav aria-label="Page navigation example">
  <ul class="pagination">
    <li class="page-item">
      <a class="page-link" href="#" aria-label="Previous">
        <span aria-hidden="true">&laquo;</span>
        <span class="sr-only">Previous</span>
      </a>
    </li>
    <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="#" aria-label="Next">
        <span aria-hidden="true">&raquo;</span>
        <span class="sr-only">Next</span>
      </a>
    </li>
  </ul>
</nav>

Disabled leh active state te

Pagination link te hi thil awmdan hrang hrangah siam danglam theih a ni. .disabledLink click theih loh anga lang leh .activetuna page awm mek tarlanna atan hmang ang che .

.disabledClass chuan s -a link functionality tihtawp tumnapointer-events: none a hman laiin , chu CSS property chu standardized a la ni lo va, keyboard navigation pawh a account lo. Chutiang a nih avang chuan disabled link te chu i add fo tur a ni a, custom JavaScript hmangin an functionality chu fully disable tur a ni.<a>tabindex="-1"

<nav aria-label="...">
  <ul class="pagination">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">Previous</a>
    </li>
    <li class="page-item"><a class="page-link" href="#">1</a></li>
    <li class="page-item active">
      <a class="page-link" href="#">2 <span class="sr-only">(current)</span></a>
    </li>
    <li class="page-item"><a class="page-link" href="#">3</a></li>
    <li class="page-item">
      <a class="page-link" href="#">Next</a>
    </li>
  </ul>
</nav>

Active emaw disabled anchors te chu option-in i swap out thei a <span>, a nih loh leh prev/next arrows-ah chuan anchor chu i omit thei bawk a, chu chuan click functionality tihbo nan leh keyboard focus venna tur leh intended styles te chu vawng reng chungin i ti thei bawk.

<nav aria-label="...">
  <ul class="pagination">
    <li class="page-item disabled">
      <span class="page-link">Previous</span>
    </li>
    <li class="page-item"><a class="page-link" href="#">1</a></li>
    <li class="page-item active">
      <span class="page-link">
        2
        <span class="sr-only">(current)</span>
      </span>
    </li>
    <li class="page-item"><a class="page-link" href="#">3</a></li>
    <li class="page-item">
      <a class="page-link" href="#">Next</a>
    </li>
  </ul>
</nav>

Sizing a ni

Pagination lian zawk emaw, te zawk emaw i duh em? Add .pagination-lgemaw .pagination-smsize dang atan emaw.

<nav aria-label="...">
  <ul class="pagination pagination-lg">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">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>
  </ul>
</nav>
<nav aria-label="...">
  <ul class="pagination pagination-sm">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">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>
  </ul>
</nav>

Alignment tih a ni

Pagination component hrang hrangte alignment chu flexbox utilities hmangin thlak rawh .

<nav aria-label="Page navigation example">
  <ul class="pagination justify-content-center">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">Previous</a>
    </li>
    <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="#">Next</a>
    </li>
  </ul>
</nav>
<nav aria-label="Page navigation example">
  <ul class="pagination justify-content-end">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">Previous</a>
    </li>
    <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="#">Next</a>
    </li>
  </ul>
</nav>