Paginator

A pagination bar with first, previous, numbered, next and last page buttons, an optional page-size select and a range report. Use it for lists, grids and server-side data; vig-table embeds one with its paginator input.

  • vig-paginator
Import
import { Paginator } from '@vigdx/ui/paginator';

Basic

State lives in two models: first , the zero-based index of the first record, and rows , the page size. Two-way bind [(first)] and slice your data with it; totalRecords is required.

  • Order #20400
  • Order #20401
  • Order #20402
  • Order #20403
  • Order #20404

Page size

rowsPerPageOptions adds a page-size select. Changing it updates rows and returns to the first page; bind both models to drive a server request.

Request: offset=0&limit=25

Sizes

size is sm (default, 28px controls on 12px text) or md (32px controls on 14px text).

Range report

reportTemplate formats the report with the {first} , {last} , {total} , {page} and {pageCount} placeholders. reportPosition places it at the start (default, split layout) or end .

Disabled

disabled turns off every button and the page-size select, e.g. while a page is loading.

Labels

Every accessible name and the report are inputs for translations; pageAriaLabel replaces {0} with the page number. Set app-wide defaults through the kit's labels instead of per instance.

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="paginator"][data-part="report"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="paginator"]

Paginator styling hooks
Part Element data-state
report The range report. —
pages Group of the navigation and page buttons. —
first First page button. —
prev Previous page button. —
page A page number button ( aria-current="page" ). active
next Next page button. —
last Last page button. —
jump The jump-to-page field ( showJumpToPage ). —
rows-per-page The page-size <select> . —
rows-per-page-option An <option> of the page-size select. —

Accessibility

  • The bar is a <nav> landmark named by ariaLabel (“Pagination” by default). With several paginators on one page, give each a distinct name.
  • All controls are native buttons and a native <select>, reachable with Tab and activated with Enter or Space.
  • Icon buttons are labelled (“First page”, “Previous page”…), numbered buttons read “Page 3”, and the current page carries aria-current="page".
  • Buttons that lead nowhere, such as Next on the last page, are aria-disabled rather than disabled: they stay focusable, so focus is not lost when the boundary is reached, and ignore activation. After a page change, consider moving focus to the top of the updated content.

API

Paginator

vig-paginator component

Standalone pagination bar (PrimeNG p-paginator territory). State lives in the first/rows models so it can be two-way bound by vig-table or used directly. The report is a function of PaginatorReport, or a string with {first}, {last}, {total}, {page} and {pageCount} placeholders.

Paginator props
Name Type Default Description
ariaLabelstring | undefinedundefined
—
disabledbooleanfalse
—
first model number0

Zero-based index of the first record on the current page.

firstPageAriaLabelstring | undefinedundefined
—
jumpToPageAriaLabelstring | undefinedundefined

Name of the jump-to-page field (i18n).

lastPageAriaLabelstring | undefinedundefined
—
nextPageAriaLabelstring | undefinedundefined
—
pageAriaLabelstring | ((page: number) => string) | undefinedundefined

Name of a page button: a function of the 1-based page number, or a string where {0} is replaced with it.

prevPageAriaLabelstring | undefinedundefined
—
reportPositionPaginatorReportPosition'start'

start splits the bar: the range report on the left, the controls on the right. end packs everything to the right with the report last.

reportTemplatestring | ((report: PaginatorReport) => string) | undefinedundefined

The range report: a function of the PaginatorReport numbers, e.g. (r) => r.first + '–' + r.last + ' of ' + r.total, or a string with {first}, {last}, {total}, {page} and {pageCount} placeholders.

rows model number10

Page size.

rowsPerPageAriaLabelstring | undefinedundefined
—
rowsPerPageOptionsreadonly number[][]

Shown as a page-size dropdown when non-empty.

showJumpToPagebooleanfalse

Adds a number field that jumps straight to a typed page (applied on change or Enter).

sizePaginatorSize'sm'

sm keeps 28px controls on 12px text; md uses 32px controls on 14px text.

totalRecords required number—
—

Are you sure?