Paginator
vig-table embeds one with its paginator input.
vig-paginator
import { Paginator } from '@vigdx/ui/paginator';Basic
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
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"]
| Part | Element | data-state |
|---|---|---|
report | — | |
pages | — | |
first | — | |
prev | — | |
page | aria-current="page" ). | active |
next | — | |
last | — | |
jump | showJumpToPage ). | — |
rows-per-page | <select> . | — |
rows-per-page-option | <option> of the page-size select. | — |
Accessibility
- The bar is a
<nav>landmark named byariaLabel(“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-disabledrather thandisabled: 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-paginatorStandalone 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.
| Name | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | undefined | undefined | — |
disabled | boolean | false | — |
first | number | 0 | Zero-based index of the first record on the current page. |
firstPageAriaLabel | string | undefined | undefined | — |
jumpToPageAriaLabel | string | undefined | undefined | Name of the jump-to-page field (i18n). |
lastPageAriaLabel | string | undefined | undefined | — |
nextPageAriaLabel | string | undefined | undefined | — |
pageAriaLabel | string | ((page: number) => string) | undefined | undefined | Name of a page button: a function of the 1-based page number, or a
string where |
prevPageAriaLabel | string | undefined | undefined | — |
reportPosition | PaginatorReportPosition | 'start' |
|
reportTemplate | string | ((report: PaginatorReport) => string) | undefined | undefined | The range report: a function of the |
rows | number | 10 | Page size. |
rowsPerPageAriaLabel | string | undefined | undefined | — |
rowsPerPageOptions | readonly number[] | [] | Shown as a page-size dropdown when non-empty. |
showJumpToPage | boolean | false | Adds a number field that jumps straight to a typed page (applied on change or Enter). |
size | PaginatorSize | 'sm' |
|
totalRecords | number | — | — |
| Name | Payload | Description |
|---|---|---|
firstChange | number | Zero-based index of the first record on the current page. |
rowsChange | number | Page size. |