use-pagination
Manages pagination state
Source
Docs
Package
Usage
The use-pagination hook is a state management hook for the Pagination component;
it manages pagination with controlled and uncontrolled state:
Controlled
The hook supports controlled mode; provide page and onChange props to manage state from outside:
Siblings
Control number of active item siblings with siblings:
1 sibling (default)
2 siblings
3 siblings
Boundaries
Control number of items on each boundary with boundaries:
To set each edge separately, pass an object with start and end keys. A missing key defaults to 1.
The example below always displays the first page and does not pin the last page:
1 boundary (default)
2 boundaries
3 boundaries
First page only
Start value
Set startValue to define the starting page number. For example, with startValue={5} and total={15},
the pagination range will be from 5 to 15:
Active page: 5
Range: [5, 6, 7, 8, 9, dots, 15]
Definition
Exported types
UsePaginationOptions, UsePaginationReturnValue and UsePaginationBoundaries types are exported from the
@thinker-core/mantine-hooks package; you can import them in your application: