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.
| Name | Type | Default | Description | Example |
|---|---|---|---|---|
| className | String | Adds custom classes | Adds custom classes | <CDBPagination className="myClass" ... /> |
| tag | String | ul | Changes default pagination tag | <CDBPagination tag="ol" ... /> |
| size | String | Changes size of pagination component. Choose from lg and sm | <CDBPagination size="sm" ... /> | |
| sm | Boolean | false | Changes the size of pagination component to sm | <CDBPagination sm .../> |
| circle | Boolean | false | Changes the shape of pagination component to circular | <CDBPagination circle .../> |
| color | String | dark | Changes 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.
| Name | Type | Default | Description | Example |
|---|---|---|---|---|
| className | String | Adds custom classes | <CDBPageItem className="myClass" ... /> | |
| tag | String | li | Changes default pagination tag | <CDBPageItem tag="li" ... /> |
| disable | Boolean | false | Disables item from being clicked | <CDBPageItem disabled .../> |
| active | Boolean | false | Sets active state of the button | <CDBPageItem active .../> |
API Reference: Contrast Pagination Link Properties
The table below shows the configuration options of the CDBPageLink component.
| Name | Type | Default | Description | Example |
|---|---|---|---|---|
| className | String | Adds custom classes | <CDBPageLink className="myClass" ... /> | |
| tag | String | li | Changes default pagination tag | <CDBPageLink tag="li" ... /> |
| disable | Boolean | false | Disables item from being clicked | <CDBPageLink disabled .../> |
| active | Boolean | false | Sets active state of the button | <CDBPageLink active .../> |