Itulautusi
Faʻamaumauga ma faʻataʻitaʻiga mo le faʻaalia o le itulau e faʻaalia ai se faasologa o mea e fesoʻotai i ai o loʻo iai i luga o le tele o itulau.
Vaaiga lautele
Matou te fa'aogaina se poloka tele o so'otaga fa'afeso'ota'i mo la matou fa'asinomaga, e faigata ai ona misia so'otaga ma fa'afaigofie ona fa'asa'oina—i taimi uma e tu'uina atu ai vaega tetele e lavea. Ua fausia le fa'asinomaga i elemene HTML lisi ina ia mafai ai e le au faitau mata ona fa'ailoa le numera o feso'ota'iga avanoa. Fa'aaogā se <nav>
elemene afifi e fa'ailoa ai o se vaega fa'atautaiga e su'e ai le au faitau ma isi tekonolosi fesoasoani.
E le gata i lea, talu ai o itulau e foliga mai e sili atu ma le tasi ia vaega faʻatautaia, e fautuaina le tuʻuina atu o se faʻamatalaga aria-label
e <nav>
atagia ai lona faʻamoemoe. Mo se faʻataʻitaʻiga, afai e faʻaogaina le vaega o le pagination e faʻatautaia ai i le va o se seti o suʻesuʻega, o se igoa talafeagai e mafai ona 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>
Galulue ma ata
Su'e e fa'aoga se atigipusa po'o se fa'ailoga e suitulaga i tusitusiga mo nisi o feso'ota'iga i le itulau? Ia mautinoa e tu'u sa'o le lagolago lau faitau mata ma aria
uiga.
<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">«</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">»</span>
</a>
</li>
</ul>
</nav>
Malo le atoatoa ma toaga
O so'otaga fa'aigoaina e mafai ona fa'avasegaina mo tulaga eseese. Fa'aoga .disabled
mo so'oga e foliga mai e le mafai ona kiliki ma fa'ailoa .active
le itulau o lo'o iai nei.
A'o .disabled
fa'aoga e le vasega pointer-events: none
e taumafai e fa'amalo le feso'ota'iga o <a>
le s, e le'i fa'ata'atia le mea totino a le CSS ma e le'o fa'atatauina le ta'avale keyboard. E pei o lea, e tatau ona e faʻaopoopo i taimi uma tabindex="-1"
i luga o fesoʻotaʻiga faʻaletonu ma faʻaaoga le JavaScript masani e faʻamalo atoatoa ai a latou galuega.
<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>
E mafai ona e suitulaga ese taula malosi pe le atoatoa mo <span>
, pe aveese le taula i le tulaga o le muamua / aū e sosoo ai, e aveese ai le kilikiina o galuega ma puipuia le taulai atu o le piano a'o taofi sitaili fuafuaina.
<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>
Tele
Mana'o e lapopo'a pe la'ititi itulau? Fa'aopoopo .pagination-lg
pe .pagination-sm
mo isi lapopo'a.
<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>
Fa'atonuga
Suia le fa'aogaina o vaega fa'akomepiuta fa'atasi ma le flexbox utilities . Mo se faʻataʻitaʻiga, faʻatasi ai ma .justify-content-center
:
<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>
Pe fa'atasi ai ma .justify-content-end
:
<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>
CSS
Fuafuaga
Fa'aopoopo i le v5.2.0I le avea ai o se vaega o le suiga o le CSS suiga a le Bootstrap, ua faʻaogaina nei e le pagination le faʻaogaina o le CSS faʻapitonuʻu .pagination
mo le faʻaleleia o le taimi moni. O tau mo le CSS fesuiaiga e faʻatulagaina e ala i le Sass, o lea o loʻo lagolagoina pea le Sass customization.
--#{$prefix}pagination-padding-x: #{$pagination-padding-x};
--#{$prefix}pagination-padding-y: #{$pagination-padding-y};
@include rfs($pagination-font-size, --#{$prefix}pagination-font-size);
--#{$prefix}pagination-color: #{$pagination-color};
--#{$prefix}pagination-bg: #{$pagination-bg};
--#{$prefix}pagination-border-width: #{$pagination-border-width};
--#{$prefix}pagination-border-color: #{$pagination-border-color};
--#{$prefix}pagination-border-radius: #{$pagination-border-radius};
--#{$prefix}pagination-hover-color: #{$pagination-hover-color};
--#{$prefix}pagination-hover-bg: #{$pagination-hover-bg};
--#{$prefix}pagination-hover-border-color: #{$pagination-hover-border-color};
--#{$prefix}pagination-focus-color: #{$pagination-focus-color};
--#{$prefix}pagination-focus-bg: #{$pagination-focus-bg};
--#{$prefix}pagination-focus-box-shadow: #{$pagination-focus-box-shadow};
--#{$prefix}pagination-active-color: #{$pagination-active-color};
--#{$prefix}pagination-active-bg: #{$pagination-active-bg};
--#{$prefix}pagination-active-border-color: #{$pagination-active-border-color};
--#{$prefix}pagination-disabled-color: #{$pagination-disabled-color};
--#{$prefix}pagination-disabled-bg: #{$pagination-disabled-bg};
--#{$prefix}pagination-disabled-border-color: #{$pagination-disabled-border-color};
Sass fesuiaiga
$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-font-size: $font-size-base;
$pagination-color: var(--#{$prefix}link-color);
$pagination-bg: $white;
$pagination-border-radius: $border-radius;
$pagination-border-width: $border-width;
$pagination-margin-start: ($pagination-border-width * -1);
$pagination-border-color: $gray-300;
$pagination-focus-color: var(--#{$prefix}link-hover-color);
$pagination-focus-bg: $gray-200;
$pagination-focus-box-shadow: $input-btn-focus-box-shadow;
$pagination-focus-outline: 0;
$pagination-hover-color: var(--#{$prefix}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;
Sass mixins
@mixin pagination-size($padding-y, $padding-x, $font-size, $border-radius) {
--#{$prefix}pagination-padding-x: #{$padding-x};
--#{$prefix}pagination-padding-y: #{$padding-y};
@include rfs($font-size, --#{$prefix}pagination-font-size);
--#{$prefix}pagination-border-radius: #{$border-radius};
}