CoreUI PRO for React.js
This Component is a part of CoreUI PRO for React.js, an advanced UI library offering over 100 components designed for creating responsive, sleek, and powerful applications. Experience it yourself by signing up for a complimentary 7-day trial.

React Smart Pagination Component

Smart Pagination

Documentation and examples for showing smart pagination to indicate a series of related content exists across multiple pages.

Other frameworks

CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.

Overview#

React smart pagination component consists of button-like styled links, that are arranged side by side in a horizontal list.

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. SmartPagination is built with list HTML elements so screen readers can announce the number of available links. SmartPagination also use a wrapping <nav> element to identify it as a navigation section to screen readers and other assistive technologies.

In addition, as pages likely have more than one such navigation section, SmartPagination provide a descriptive aria-label for the <nav> to reflect its purpose. 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".???

const [currentPage, setCurrentPage] = useState(1)
return <CSmartPagination activePage={currentPage} pages={10} onActivePageChange={setCurrentPage} />

Features#

  • Determine behavior, style and functionality of pagination
  • Smart automatic items generation

Working with icons#

Looking to use an icon or symbol in place of text for some pagination links? SmartPagination will provide screen reader support for 'firstButton', 'previousButton', 'nextButton' and 'lastButton'.

Sizing#

Fancy larger or smaller pagination? Add size="lg" or size="sm" for additional sizes.

const [currentPage, setCurrentPage] = useState(1)
return (
<CSmartPagination
size="lg"
activePage={currentPage}
pages={10}
onActivePageChange={setCurrentPage}
/>
)
const [currentPage, setCurrentPage] = useState(1)
return (
<CSmartPagination
size="sm"
activePage={currentPage}
pages={10}
onActivePageChange={setCurrentPage}
/>
)

Alignment#

Change the alignment of pagination components with align="start", align="center" or align="end" flexbox utilities.

const [currentPage, setCurrentPage] = useState(1)
return (
<CSmartPagination
align="center"
activePage={currentPage}
pages={10}
onActivePageChange={setCurrentPage}
/>
)
const [currentPage, setCurrentPage] = useState(1)
return (
<CSmartPagination
align="end"
activePage={currentPage}
pages={10}
onActivePageChange={setCurrentPage}
/>
)

API#

CSmartPagination#

import { CSmartPagination } from '@coreui/react-pro'
// or
import CSmartPagination from '@coreui/react-pro/src/components/smart-pagination/CSmartPagination'
PropertyDescriptionTypeDefault
activePageCurrent page number.number1
alignHorizontall align.'start' | 'center' | 'end'start
arrowsShow/hide arrows.booleantrue
classNameA string of all className you want applied to the base component.string-
dotsShow/hide dots.booleantrue
doubleArrowsShow double arrows buttons.booleantrue
firstButtonThe content of 'firstButton' button.ReactNode<React.Fragment>«</React.Fragment>
lastButtonThe content of 'lastButton' button.ReactNode<React.Fragment>»</React.Fragment>
limitMaximum items number.number5
nextButtonThe content of 'nextButton' button.ReactNode<React.Fragment>›</React.Fragment>
onActivePageChangeOn active page change callback.(activePage: number) => void-
pagesNumber of pages.number-
previousButtonThe content of 'previousButton' button.ReactNode<React.Fragment>‹</React.Fragment>
sizeSize of pagination, valid values: 'sm', 'lg'.'sm' | 'lg'-