Bootstrap 5 Pagination
Create "Previous/Next" or "Next n" controls with Bootstrap's pagination classes.
Bootstrap's .pagination
class does just what its name promises — it provides pagination.
Pagination is typically where you have navigation that links to multiple pages within a series. For example, search results that return many pages will have pagination that enables the user to navigate to the next page or even jump forward several pages.
Default Pagination
To create default pagination, add class="pagination"
to the <ul>
element that represents the list of pages.
Also add .page-item
to each <li>
element and .page-link
to each <a>
element.
Also, in the name of semantic HTML, it should be enclosed in a <nav>
element with a descriptive aria-label
to reflect its purpose.
Active State for Current Page
Add the .active
class to the <li>
element that represents the current page (the page that the user is currently on).
Disabling an Option
Add the .disabled
class to the <li>
element to disable that option.
Pagination Size
Add either the .pagination-lg
or .pagination-sm
to the <ul>
element to increase or decrease the size of the pagination controls.