# Flux 2.0 — Pagination Range text and page links for a long list that is served one page at a time. Reference: https://flux.kaptio.com/components/pagination/ Requires: https://flux.kaptio.com/tokens/v2/flux.css and flux-components.css ## Use it when Splits a long, server-side result into pages and says which part is showing: 26–50 of 312. The page links are real links, so a page can be bookmarked, opened in a new tab and reached with the back button. Previous and Next stay in place and disable at the ends rather than disappearing, and a long run of pages collapses around the current one with gaps. ## Do not use it when Not for a list short enough to show in full. Not for a feed read top to bottom; load more on request instead. Not for client-side tables of a few hundred rows, which can scroll. ## Markup ### Below a table
Bookings, page 2 of 13
Reference Departure Pax
KB-104953Golden Circle, 21 Sep6
KB-104954South Coast, 22 Sep2
KB-104957Snæfellsnes, 22 Sep11
### Previous and next only ## API - flux-pagination (class): On the nav. Give it aria-label="Pagination". - flux-pagination__range (class): The range text. - flux-pagination__list (class): On the ul of links. - flux-pagination__link (class): On every link, and on the span that replaces a disabled Previous or Next. - flux-pagination__page (class): Adds mono figures to a page number link. Label it "Page n". - flux-pagination__gap (class): The ellipsis for omitted pages, with aria-hidden. - aria-current="page" (attribute): On the current page’s link. - aria-disabled="true" (attribute): On the span for Previous or Next at an end. ## Accessibility - Label the nav "Pagination", and each number "Page n", so a list of links reads as pages. - The current page carries aria-current="page", so it is not conveyed by fill alone. - Update the table caption with the page number, so the change is clear after the page loads. - Move focus to the top of the results after a page change that does not reload the page. ## Keyboard - Tab: Moves through the links. Disabled ends and gaps are skipped. - Enter: Opens the page. ## Tokens - --flux-pagination-gap | -item-size | -item-text | -item-hover - --flux-pagination-current-bg | -current-text - --flux-pagination-range ## Do - Show the first page, the last page and the pages either side of the current one. - Keep the page in the URL so the back button returns to it. ## Do not - Do not hide Previous or Next at an end: disable it. - Do not use buttons for pages when a URL can identify each one. - Do not shrink row height to fit more rows on a page.