use-pagination
Manages pagination state
Source
Docs
PackageIcon
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:
1 boundary (default)
2 boundaries
3 boundaries
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 and UsePaginationReturnValue types are exported from the @mantine/hooks package;
you can import them in your application: