pagination

API / @publicodes/forms / pagination

function pagination<RuleName>(formState): object

Defined in: form.ts:131

Retrieves pagination information for the current form state.

Type Parameters

Type ParameterDescription
RuleName extends stringThe existing rule names

Parameters

ParameterTypeDescription
formStateFormState<RuleName>The current state of the form

Returns

object

An object containing pagination details:

  • current - Current page number (1-based)
  • pageCount - Total number of pages
  • hasNextPage - Whether there is a next page
  • hasPreviousPage - Whether there is a previous page
NameTypeDefined in
currentnumberform.ts:137
hasNextPagebooleanform.ts:139
hasPreviousPagebooleanform.ts:140
pageCountnumberform.ts:138

Example

const { current, pageCount, hasNextPage } = pagination(formState)
if (hasNextPage) {
  // Show next page button
}