@renderlesskit/react
Version:
Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit
77 lines (76 loc) • 1.6 kB
TypeScript
export declare type PaginationState = {
/**
* The current active page
*/
currentPage: number;
/**
* All the page with start & end ellipsis
*/
pages: (string | number)[];
/**
* True, if the currentPage is at first page
*/
isAtFirstPage: boolean;
/**
* True, if the currentPage is at last page
*/
isAtLastPage: boolean;
};
export declare type PaginationAction = {
/**
* Go to the specified page number
*/
movePage: (page: number) => void;
/**
* Go to next page
*/
nextPage: () => void;
/**
* Go to previous page
*/
prevPage: () => void;
/**
* Go to first page
*/
firstPage: () => void;
/**
* Go to last page
*/
lastPage: () => void;
};
export declare type PaginationInitialState = {
/**
* Set the default page(uncontrollable)
*
* @default 1
*/
defaultPage?: number;
/**
* Set the page(controllable)
*/
page?: number;
/**
*
*/
onChange?: (page: number) => void;
/**
* Total no. of pages
*
* @default 1
*/
count?: number;
/**
* No. of boundary pages to be visible
*
* @default 1
*/
boundaryCount?: number;
/**
* No. of sibiling pages allowed before/after the current page
*
* @default 1
*/
siblingCount?: number;
};
export declare type PaginationStateReturn = PaginationState & PaginationAction;
export declare const usePaginationState: (props?: PaginationInitialState) => PaginationStateReturn;