NIB / DOCUMENTATION
Pagination — NibComponents
Change a controlled page and make the displayed data follow it.
Open interactive viewAccept a page change and rebuild the content
currentPage is controlled and one-based. onPageChanged reports the requested page; the host updates the value and the data shown above it. The preview changes three numbered local notes so the control’s effect is visible. It does not perform a network query.
When Total pages becomes smaller than the current page, this host clamps the current page to the valid range. Decide how your application handles an empty dataset, a failed fetch, or a filter that removes pages. The paginator itself is not a data-loading controller.
Choose numbered or compact controls
The numbered variant shows boundary pages, siblings around the current page, and ellipses. siblingCount and boundaryCount configure that range. The compact variant shows previous/next navigation and a label, with compactLabelBuilder available for custom text.
showPrevNext and showFirstLast control the surrounding navigation actions. disabled blocks page changes; a first-page previous action is unavailable at its boundary. This demo keeps labels and notes synchronized after either layout is selected.
Use the range helper when building another presentation
paginationRange returns a List<int?>. Page numbers are integers; null is an ellipsis slot. It returns an empty list when totalPages is zero or below. A single missing page is shown as that page rather than an unnecessary ellipsis.
The widget and helper use the same one-based page model. Do not pass a zero-based database offset as currentPage; convert it in your host. The public NibPaginationVariant enum has numbered and compact values.
Keep loading and selection policies explicit
animated opts into active-page feedback. itemSize, gap, activeColor, and itemBorderRadius adjust the control appearance. At narrow width, inspect the numbered layout and consider compact presentation rather than shrinking labels.
For a server-backed table, retain the previous rows or show a loading state while fetching, prevent stale responses from replacing newer pages, and show failures without lying about the current data. A callback firing proves only that a page was requested.