Create a unordered list and add the .pagination
class to the <ul>
element. Add the .page-item
to each <li>
element and .page-link
class to each link inside <li>
.
To support assistive technologies – such as screen readers wrap pagination with <nav>
element to identify it as a navigation section to screen readers and other assistive technologies. A page can have more than one navigation section so it is recommended to provide a descriptive aria-label
for the<nav>
. For example, if the pagination component is used to navigate between a set of search results, an appropriate label could be aria-label="Search results pages"
.
Use can also use an icon or symbol instead of text for some pagination links. For example you can use html symbols(arrows) or icons for "Next" and "Previous" links.
When using icons provide proper screen reader support with aria
attributes and the .sr-only
utility.
You can customize Pagination links. Use .disabled
for links that appear un-clickable and .active
to indicate the current page.
The .disabled
class uses pointer-events: none
to disable the link functionality of <a>
s. This CSS property is not yet standardized so always add tabindex="-1"
on disabled links and use custom JavaScript to fully disable their functionality.
You can also omit the anchor in the case of the prev/next arrows and wrap using <span>
to remove click functionality and prevent keyboard focus which retains the intended styles.
For larger pagination sizes add .pagination-lg
and for smaller pagination sizes add .pagination-sm
You can change the alignment of pagination components with flexbox utilities.
Add .justify-content-center
to align pagination in the center.
Add .justify-content-end
to align pagination to the right.