Describe The Problem To Be Solved
Fixed size pagination example from kb is best reference:
https://kobalte.dev/docs/core/components/pagination#fixed-items-example
The elements shown have to dynamically adjust for a consistent interface. Show page numbers when current page is close, show ellipsis when far.
Note: Kobalte uses siblingCount={1} instead of maxPages={7}, maybe consider using the same? (and remove maxPages)
Suggest A Solution
Add 2 props:
type PaginationOptions = {
/** the number of pages to show at the same time around the current page */
siblingCount?: number; // replaces maxPages
...
/** show an element between current page and first/last */
showEllipsis?: boolean | ((page: number, pages: number) => boolean);
...
/** content for the ellipsis element, e.g. an SVG icon, default is "…" */
ellipsisContent?: JSX.Element;
...
}
const [paginationProps, page, setPage] = createPagination({ pages: 10, ellipsis: true });
// works the same
<For each={paginationProps()}>{props => <button {...props} />}</For>
Describe The Problem To Be Solved
Fixed size pagination example from kb is best reference:
https://kobalte.dev/docs/core/components/pagination#fixed-items-example
The elements shown have to dynamically adjust for a consistent interface. Show page numbers when current page is close, show ellipsis when far.
Note: Kobalte uses
siblingCount={1}instead ofmaxPages={7}, maybe consider using the same? (and removemaxPages)Suggest A Solution
Add 2 props: