Salá koleka na makambo ya ntina Salta na navigation ya docs
in English

Kosala ba paginations

Mikanda mpe bandakisa mpo na kolakisa nkasa mpo na kolakisa molɔngɔ́ ya makambo oyo etali yango ezali na kati ya nkasa mingi.

Botali ya mozindo

Tosalelaka bloc monene ya ba liens oyo ekangami mpo na pagination na biso, kosala ete ba liens ezala mpasi mpo na kozanga mpe ekoki ko évoluer na pete —nyonso wana ezali kopesa bisika minene ya kobeta. Pagination etongami na ba éléments HTML ya liste mpo batangi ya écran bakoka kosakola motango ya ba liens oyo ezali. Salelá eloko ya kokanga <nav>mpo na koyeba yango lokola eteni ya kotambwisa mpo na batángi ya écran mpe mayele mosusu ya kosalisa.

En plus, lokola ba pages eza probablement na plus d'une section ya navigation ya boye, eza conseillé kopesa descriptif aria-labelpona pona <nav>ko refleter but na yango. Na ndakisa, soki eteni ya pagination esalelami mpo na kotambola kati na ensemble ya ba résultats ya boluki, étiquette oyo ebongi ekoki kozala 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>

Kosala na ba icons

Ozali koluka kosalela elembo to elembo na esika ya makomi mpo na mwa ba liens ya pagination? Bozala sûr ya kopesa lisungi ya motángi ya écran oyo ebongi na ba ariaattributs.

<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>
      </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>
      </a>
    </li>
  </ul>
</nav>

Ba états handicapés na actives

Ba liens ya pagination ezali personnalisable pona ba circonstances différentes. Salelá .disabledmpo na ba liens oyo emonani ete okoki kofina te mpe .activempo na komonisa lokasa oyo ozali kosalela.

Alors que .disabledclasse esalelaka pointer-events: nonepona koluka ko désactiver fonctionnalité ya lien ya <a>s, propriété CSS wana eza nanu standardisé te pe ezo comptabiliser navigation ya clavier te. Lokola yango, osengeli ntango nyonso kobakisa tabindex="-1"na ba liens oyo ekangami mpe kosalela JavaScript oyo esalemi na kolanda bamposa ya moto mpo na kokanga mosala na yango mobimba.

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

Okoki na bolingi ya ko swap out ba ancres actifs to désactivés mpo na <span>, to kotika anchor na cas ya ba flèches prév/next, mpo na kolongola fonctionnalité ya cliquage mpe kopekisa focus ya clavier tout en gardant ba styles oyo ekanamaki.

<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" aria-current="page">
      <span class="page-link">2</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>

Kosala bonene ya biloko

Fancy pagination ya monene to ya moke? Bakisa .pagination-lgto .pagination-smmpo na ba taille mosusu.

<nav aria-label="...">
  <ul class="pagination pagination-lg">
    <li class="page-item active" aria-current="page">
      <span class="page-link">1</span>
    </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 active" aria-current="page">
      <span class="page-link">1</span>
    </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>

Kobongisa makambo

Bobongola alignment ya ba composants ya pagination na ba utilitaires flexbox .

<nav aria-label="Page navigation example">
  <ul class="pagination justify-content-center">
    <li class="page-item disabled">
      <a class="page-link">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">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>

Sass oyo azali

Ba variables oyo ezali

$pagination-padding-y:              .375rem;
$pagination-padding-x:              .75rem;
$pagination-padding-y-sm:           .25rem;
$pagination-padding-x-sm:           .5rem;
$pagination-padding-y-lg:           .75rem;
$pagination-padding-x-lg:           1.5rem;

$pagination-color:                  $link-color;
$pagination-bg:                     $white;
$pagination-border-width:           $border-width;
$pagination-border-radius:          $border-radius;
$pagination-margin-start:           -$pagination-border-width;
$pagination-border-color:           $gray-300;

$pagination-focus-color:            $link-hover-color;
$pagination-focus-bg:               $gray-200;
$pagination-focus-box-shadow:       $input-btn-focus-box-shadow;
$pagination-focus-outline:          0;

$pagination-hover-color:            $link-hover-color;
$pagination-hover-bg:               $gray-200;
$pagination-hover-border-color:     $gray-300;

$pagination-active-color:           $component-active-color;
$pagination-active-bg:              $component-active-bg;
$pagination-active-border-color:    $pagination-active-bg;

$pagination-disabled-color:         $gray-600;
$pagination-disabled-bg:            $white;
$pagination-disabled-border-color:  $gray-300;

$pagination-transition:              color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;

$pagination-border-radius-sm:       $border-radius-sm;
$pagination-border-radius-lg:       $border-radius-lg;

Ba mixins

@mixin pagination-size($padding-y, $padding-x, $font-size, $border-radius) {
  .page-link {
    padding: $padding-y $padding-x;
    @include font-size($font-size);
  }

  .page-item {
    @if $pagination-margin-start == (-$pagination-border-width) {
      &:first-child {
        .page-link {
          @include border-start-radius($border-radius);
        }
      }

      &:last-child {
        .page-link {
          @include border-end-radius($border-radius);
        }
      }
    } @else {
      //Add border-radius to all pageLinks in case they have left margin
      .page-link {
        @include border-radius($border-radius);
      }
    }
  }
}