@codecraftkit
Documentation
The Paginate is used to handle a page Change in an amount of data predefined.
It is recommended to use it with the DataTable
.
This component is based on react-paginate
it can be imported from the core.
import { Paginate } from "@codecraftkit/core";
or alone.
import Paginate from "@codecraftkit/paginate";
because the total
is set on 50 and the limit
is set on 10, each page will have 10 items
<Paginatetotal={50}limit={10}onPageChange={(page)=>console.log(page)}/>
<Paginatetotal={50}limit={10}onPageChange={(page)=>console.log(page)}justifyRight={false}/>
total
Number
yes
The total of items in the data
limit
Number
yes
The number of items to show
onPageChange
Function
no
The function to handle a page change
loading
Boolean
no
false
Show a loading animation
legend
Boolean
no
true
Shows a legend along with a select
showNumbers
Boolean
no
false
Shows a numbers between arrows, ot only works on render
justifyRight
Boolean
no
true
Push items to the right
statePage
state
no
State that handles the paginate page, it must start at 1
setStatePage
setState
no
Let the paginate handle the setState logic, this disables onPageChange prop
isAtBottom
Boolean
no
false
Changes the orientation where the select page is displayed