Skip to content

Paginator ​

hx-paginator is the page navigation of a list or table: first, previous, a window of page links, next, last, and an optional rows-per-page select. It is a nav landmark; the current page link has aria-current="page".

html
<hx-paginator [rows]="10" [totalRecords]="120" [(first)]="first" [rowsPerPageOptions]="[10, 20, 50]"
  showCurrentPageReport (pageChange)="load($event)" />

first is the index of the first record shown (so the page is first / rows); a change of the rows per page keeps the first record on screen.

Inputs and outputs ​

NameTypeDefault
rows (model)number10Records per page.
totalRecordsnumber0Number of records in all.
first (model)number0Index of the first record shown (0-based).
rowsPerPageOptions(number | 'all')[]noneShows the rows-per-page select; 'all' adds an entry that shows one page with every record.
showAll (model)booleanfalseThe "All" size is chosen (only in effect while rowsPerPageOptions contains 'all'); rows is left unchanged.
allLabelstring'All'The label of the 'all' entry.
pageLinkSizenumber5Page links shown at most; the current page stays in the middle.
showCurrentPageReportbooleanfalseShows currentPageReportTemplate (polite live region).
currentPageReportTemplatestring'{first} - {last} of {totalRecords}'Also {page} and {pageCount}.
showFirstLastButtonsbooleantrueThe first and last page buttons.
ariaLabel, firstPageLabel, previousPageLabel, nextPageLabel, lastPageLabel, pageLabelTemplate, rowsPerPageLabelstringEnglishThe labels, for translation (pageLabelTemplate replaces {page}).
pageChangeHxPageEvent{ first, rows, page, pageCount } after a user change; with "All" rows is the number of all records (at least 1) and all: true is set.

goTo(page) (0-based, clamped) is public for a template reference.

Accessibility ​

A nav with aria-label; every button has an accessible name ("First page", "Page 3", …); the current page link has aria-current="page"; first/previous are disabled on the first page and next/last on the last. All controls are native buttons, so Tab, Enter and Space work as usual.

Tokens ​

The look comes from the design tokens --h-paginator-* (see Theming); override them in your theme, never the component CSS.

Part of @gravionlabs/helix-ui; all components are listed in the component reference.

Released under the MIT licence.