🤩
Windframe Import Update is finally here.

Pagination

React Bootstrap 5 Pagination

React Bootstrap 5 Pagination is a component used to indicate a series of related content across multiple pages and enables navigation across them.

We use a large block of connected links for our pagination, making links hard to miss and easily scalable while providing large hit areas. Pagination is built with a list of HTML elements so screen readers can announce the number of available links. We use a wrapping <nav> element to identify it as a navigation section to screen readers and other assistive technologies.

Importing the React Bootstrap 5 Pagination Component

To use the Contrast React Bootstrap 5 Pagination component, you import CDBPagination into your project.

js
import { CDBPagination } from "cdbreact";

Alongside the CDBPagination component, we also import the CDBPageItem, representing an item in the CDBPagination component. Next, we imported the CDBPageLink component, this component acts as a link.

js
import { CDBPagination, CDBPageLink, CDBPageItem, CDBContainer } from "cdbreact";

Default Pagination

js
import React from "react";
import { CDBPagination, CDBPageLink, CDBPageItem, CDBContainer } from "cdbreact";
const Pagination = () => {
return (
<CDBContainer>
<CDBPagination circle>
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
<CDBPagination circle size="big" color="success">
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
<CDBPagination size="small" color="secondary">
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
<CDBPagination color="warning" sm>
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
<CDBPagination color="white" sm>
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
<CDBPagination color="light">
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
<CDBPagination color="danger">
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
<CDBPagination>
<CDBPageLink>Prev</CDBPageLink>
<CDBPageItem>1</CDBPageItem>
<CDBPageItem>2</CDBPageItem>
<CDBPageItem>3</CDBPageItem>
<CDBPageLink>Next</CDBPageLink>
</CDBPagination>
</CDBContainer>
);
};
export default Pagination;

API Reference: Contrast React Bootstrap 5 Pagination Props

This section will build on your information about the props you get to use with the Contrast React Bootstrap 5 Pagination component. You will find out what these props do, their default values, and how you would use them in your code.

The table below lists other prop options of the CDBPagination component.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classesAdds custom classes<CDBPagination className="myClass" ... />
tagStringulChanges default pagination tag<CDBPagination tag="ol" ... />
sizeStringChanges size of pagination component. Choose from lg and sm<CDBPagination size="sm" ... />
smBooleanfalseChanges the size of pagination component to sm<CDBPagination sm .../>
circleBooleanfalseChanges the shape of pagination component to circular<CDBPagination circle .../>
colorStringdarkChanges default pagination buttons color; available values: [blue, red, teal, dark-grey, dark, blue-grey, amber, purple]<CDBPagination color="red" ... />

API Reference: Contrast React Bootstrap 5 Pagination Item Props

The table below lists other prop options of the CDBPageItem component.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classes<CDBPageItem className="myClass" ... />
tagStringliChanges default pagination tag<CDBPageItem tag="li" ... />
disableBooleanfalseDisables item from being clicked<CDBPageItem disabled .../>
activeBooleanfalseSets active state of the button<CDBPageItem active .../>

API Reference: Contrast React Bootstrap 5 Pagination Link Props

The table below lists other prop options of the CDBPageLink component.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classes<CDBPageLink className="myClass" ... />
tagStringliChanges default pagination tag<CDBPageLink tag="li" ... />
disableBooleanfalseDisables item from being clicked<CDBPageLink disabled .../>
activeBooleanfalseSets active state of the button<CDBPageLink active .../>

Trying to build out all user interfaces and components for your website or web app from scratch can become a very tedious task. A huge reason why we created Contrast Bootstrap to help reduce the amount of time we spend doing that, so we can focus on building some other aspects of the project. Contrast Bootstrap PRO consists of a UI Kit featuring over 10000+ component variants. Together with a template of 5 admin dashboards and 23+ additional multipurpose pages template for building almost any type of website or web app. You can view a demo and learn more about Contrast by clicking here.Download the free react template

ad-banner

Contrast Bootstrap PRO was built using the most popular CSS framework Bootstrap to help build your next landing, admin SAAS, prelaunch etc project with a clean, prebuilt and well documented template and UI components.Learn more about Contrast