To use this component you must have a CoreUI PRO license. Buy the CoreUI PRO and get access to all PRO components, features, templates, and dedicated support.
Documentation and examples for showing smart pagination to indicate a series of related content exists across multiple pages.
CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.
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"
.???
1const [currentPage, setCurrentPage] = useState(1)2return <CSmartPagination activePage={currentPage} pages={10} onActivePageChange={setCurrentPage} />
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'.
Fancy larger or smaller pagination? Add size="lg"
or size="sm"
for additional sizes.
1const [currentPage, setCurrentPage] = useState(1)2return (3 <CSmartPagination4 size="lg"5 activePage={currentPage}6 pages={10}7 onActivePageChange={setCurrentPage}8 />9)
1const [currentPage, setCurrentPage] = useState(1)2return (3 <CSmartPagination4 size="sm"5 activePage={currentPage}6 pages={10}7 onActivePageChange={setCurrentPage}8 />9)
Change the alignment of pagination components with align="start"
, align="center"
or align="end"
flexbox utilities.
1const [currentPage, setCurrentPage] = useState(1)2return (3 <CSmartPagination4 align="center"5 activePage={currentPage}6 pages={10}7 onActivePageChange={setCurrentPage}8 />9)
1const [currentPage, setCurrentPage] = useState(1)2return (3 <CSmartPagination4 align="end"5 activePage={currentPage}6 pages={10}7 onActivePageChange={setCurrentPage}8 />9)
1import { CSmartPagination } from '@coreui/react-pro'2// or3import CSmartPagination from '@coreui/react-pro/src/components/smart-pagination/CSmartPagination'
Property | Description | Type | Default |
---|---|---|---|
activePage | Current page number. | number | 1 |
align | Horizontall align. | 'start' | 'center' | 'end' | start |
arrows | Show/hide arrows. | boolean | true |
className | A string of all className you want applied to the base component. | string | - |
dots | Show/hide dots. | boolean | true |
doubleArrows | Show double arrows buttons. | boolean | true |
firstButton | The content of 'firstButton' button. | ReactNode | <React.Fragment>«</React.Fragment> |
lastButton | The content of 'lastButton' button. | ReactNode | <React.Fragment>»</React.Fragment> |
limit | Maximum items number. | number | 5 |
nextButton | The content of 'nextButton' button. | ReactNode | <React.Fragment>›</React.Fragment> |
onActivePageChange | On active page change callback. | (activePage: number) => void | - |
pages | Number of pages. | number | - |
previousButton | The content of 'previousButton' button. | ReactNode | <React.Fragment>‹</React.Fragment> |
size | Size of pagination, valid values: 'sm', 'lg'. | 'sm' | 'lg' | - |