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 Parameter | Description |
---|---|
RuleName extends string | The existing rule names |
Parameters
Parameter | Type | Description |
---|---|---|
formState | FormState <RuleName > | The current state of the form |
Returns
object
An object containing pagination details:
current
- Current page number (1-based)pageCount
- Total number of pageshasNextPage
- Whether there is a next pagehasPreviousPage
- Whether there is a previous page
Name | Type | Defined in |
---|---|---|
current | number | form.ts:137 |
hasNextPage | boolean | form.ts:139 |
hasPreviousPage | boolean | form.ts:140 |
pageCount | number | form.ts:138 |
Example
const { current, pageCount, hasNextPage } = pagination(formState)
if (hasNextPage) {
// Show next page button
}