Pagination

Pagination

Pagination is a component used to indicate existence of 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—all while providing large hit areas. Pagination is built with list 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.

Examples

Default Pagination example.

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

In this section you will find advanced information about the Pagination component. You will find out which modules are required, what are the possibilities of configuring the component, and what events and methods you can use to work with it.

Contrast Pagination Import Statement

You need to import the Contrast Pagination component first before using it.

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

API Reference: Contrast Pagination Properties

The table below shows the configuration 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 Pagination Item Properties

The table below shows the configuration 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 Pagination Link Properties

The table below shows the configuration 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 .../>