@makolabs/ripple
Version:
Simple Svelte 5 powered component library ✨
58 lines (57 loc) • 2.3 kB
TypeScript
import type { ClassValue } from 'tailwind-variants';
/**
* Pagination component props
*/
export interface PaginationProps {
/** Current page number (1-indexed). If not provided, component manages state internally. */
currentPage?: number;
/** Total number of items across all pages */
totalItems: number;
/** Number of items per page */
pageSize?: number;
/** Callback when page changes */
onPageChange?: (page: number) => void;
/** Callback when page size changes */
onPageSizeChange?: (pageSize: number) => void;
/** Callback when first page is clicked */
onFirstPage?: () => void;
/** Callback when last page is clicked */
onLastPage?: () => void;
/** Whether pagination controls are disabled */
disabled?: boolean;
/** Show page size selector */
showPageSize?: boolean;
/** Available page size options */
pageSizeOptions?: number[];
/** Pagination template mode: 'full' shows page numbers, 'compact' shows "Page X of Y" */
template?: 'full' | 'compact';
/** Show "Showing X to Y of Z results" text */
showInfo?: boolean;
/** Show navigation buttons (first, prev, next, last) */
showNavigation?: boolean;
/** Show first/last page buttons */
showFirstLast?: boolean;
/** Show page number buttons (only applies when template='full') */
showPageNumbers?: boolean;
/** Maximum number of visible page buttons */
maxVisiblePages?: number;
/** Always show first and last page numbers when there are many pages */
alwaysShowFirstLast?: boolean;
/** Hide pagination when there's only one page */
hideWhenSinglePage?: boolean;
/** Hide pagination when there are no items */
hideWhenNoItems?: boolean;
/** Custom class for wrapper */
class?: ClassValue;
/** Custom class for info text */
infoClass?: ClassValue;
/** Custom class for navigation buttons */
buttonClass?: ClassValue;
/** Custom class for active page button */
activeButtonClass?: ClassValue;
/** Use internal state management (when currentPage is not provided) */
internalState?: boolean;
}
declare const Pagination: import("svelte").Component<PaginationProps, {}, "">;
type Pagination = ReturnType<typeof Pagination>;
export default Pagination;