Toolbox-XToolbox-X

Paginator

The Paginator class provides pagination options with automatic safety clamping.

Paginator

This documentation provides complete coverage of all methods in the Paginator class, organized into logical categories with detailed sections for each method.

Table of Contents


Constructor

Signature

constructor(options: PaginatorOptions)

Parameters

ParameterTypeDescription
optionsPaginatorOptionsPagination configuration.
interface PaginatorOptions {
  totalItems: Numeric;
  itemsPerPage?: Numeric; // default: 10
  currentPage?: Numeric; // default: 1
}

Behavior

  • Initializes paginator with provided values.
  • Applies safety clamping:
    • totalItems ≥ 0
    • itemsPerPage ≥ 1
    • currentPage ≥ 1

Example

playground.ts

Type Definitions

Numeric

type Numeric = number | `${number}`;

Union type accepting numbers or numeric strings.

PaginatorOptions

interface PaginatorOptions {
  totalItems: Numeric;
  itemsPerPage?: Numeric;
  currentPage?: Numeric;
}

Initialization options with defaults.

PaginatorMeta

interface PaginatorMeta {
  totalItems: number;
  currentPage: number;
  itemsPerPage: number;
  totalPages: number;
  hasPrev: boolean;
  hasNext: boolean;
  isFirst: boolean;
  isLast: boolean;
  offset: number;
}

Complete pagination metadata.

PageListOptions

interface PageListOptions {
  edgeCount?: number;
  siblingCount?: number;
}

Page list generation options.

FromMetaOptions

type FromMetaOptions = Pick<PaginatorMeta, 'totalItems' | 'itemsPerPage' | 'currentPage'>;

Last updated: Sun, Jun 14, 2026 08:22:19PM (UTC)

On this page