Toolbox-XToolbox-X

Instance Creation Methods

Methods for creating new Paginator instances with modified parameters.

withPage()

Signature

withPage(page: number): Paginator

Parameters

ParameterTypeDescription
pagenumberNew current page number.

Returns

  • Paginator: New instance with updated page. Clamps page between 1 and the last page. The original instance remains unchanged.

Example

playground.ts

withPerPage()

Signature

withPerPage(perPage: number): Paginator

Parameters

ParameterTypeDescription
perPagenumberNew items per page value.

Returns

  • Paginator: New instance with updated items per page. Clamps value to minimum 1. Automatically adjusts current page if needed.

Example

playground.ts

withTotalItems()

Signature

withTotalItems(totalItems: number): Paginator

Parameters

ParameterTypeDescription
totalItemsnumberNew total items count.

Returns

  • Paginator: New instance with updated total. Clamps value to minimum 0. Automatically adjusts current page if needed.

Example

playground.ts

withOptions()

Signature

withOptions(options: Partial<PaginatorOptions>): Paginator

Parameters

ParameterTypeDescription
optionsPartial<PaginatorOptions>Partial options to override.

Returns

  • Paginator: New instance with merged options. Applies the same clamping rules as the constructor. Only provided values are updated.

Example

playground.ts

Last updated: Sun, Jun 14, 2026 07:15:25PM (UTC)

On this page