4.2.0
Core

Pagination

A rail of links to the rest of a long list โ€” it holds no page state, only says which page you are on.

Default

A rail of links, built out of `buttonVariants` rather than out of new classes โ€” the active page is `outline`, the rest are `ghost`. It holds no page state: `isActive` is what the caller says, and its real output is `aria-current="page"`. The outline is decoration; the attribute is the announcement.

Usage

import {
  Pagination,
  PaginationContent,
  PaginationEllipsis,
  PaginationItem,
  PaginationLink,
  PaginationNext,
  PaginationPrevious,
} from '@oceanic-hub/brand-system'
<Pagination>
  <PaginationContent>
    <PaginationItem>
      <PaginationPrevious>โ€ฆ</PaginationPrevious>
      <PaginationLink>โ€ฆ</PaginationLink>
      <PaginationEllipsis>โ€ฆ</PaginationEllipsis>
      <PaginationNext>โ€ฆ</PaginationNext>
    </PaginationItem>
  </PaginationContent>
</Pagination>

Composition

Use the following composition to build a Pagination:

Pagination
โ””โ”€โ”€ PaginationContent
    โ””โ”€โ”€ PaginationItem ร—9
        โ”œโ”€โ”€ PaginationPrevious
        โ”œโ”€โ”€ PaginationLink
        โ”œโ”€โ”€ PaginationEllipsis
        โ””โ”€โ”€ PaginationNext

Reach for it when a reader needs to come back: page 7 of an audit log, a result they want to link a colleague to, a list too long to scan but ordered enough to navigate. When the list is a feed nobody cites and nobody returns to, a "Load more" button is the kinder answer โ€” pagination's whole value is that a page has an address.

Nothing here fetches, counts or slices. isActive is a claim the caller makes and its real output is aria-current="page" โ€” the outline is decoration, the attribute is the announcement, and a rail that marks two pages active has told a screen reader something false. DataTable does not compose this: its rows are whatever the caller decided to show, so the rail is a sibling underneath the grid and the join stays where the data is.

Three things here are more than upstream carries, each with a section of its own below. Every part forwards a ref, where upstream forwards on only two โ€” and the ones it missed are exactly the ones a caller needs a node for: centring the current page in a scrolling rail, or measuring how many links fit. asChild turns a page link into the host's own link component, without which every page click in a Next app is a full document load that no call site can fix from the outside. It is declared on PaginationLink, and PaginationPrevious/ PaginationNext take it directly too โ€” each wraps its label in Slottable (@OCE-1871), so the slot Radix resolves onto is always the label, whatever is inside it, and the arrow's own chevron rides along as a sibling instead of competing with the label for the one child a Slot can hold. The words are defaults, not assertions: pass children and "Previous", "Next" and "More pages" become whatever the surface needs, because a shared component does not get to author the words a caller's user reads.

One correction rather than a port, worth knowing since it is invisible: upstream marks the ellipsis aria-hidden and then nests the only sentence it has โ€” "More pages" โ€” inside that hidden subtree, so a screen reader gets silence where a sighted reader sees the sequence break. Here the glyph is hidden and the sentence is not. RTL is not supported, and upstream ships an RTL example; nothing in this package has been laid out or measured right-to-left, and the refusal is written down in pairings.json under direction.

Simple

Just the numbers, for a range short enough to show whole โ€” a filter's results, a five-page report. Dropping the arrows drops two targets a reader never needs when every page is already one click away, and it is the shape that fits in a card footer without wrapping.

Icons only

Two arrows and no numbers, for a footer that is already carrying a row count and a selection count and cannot afford a rail of digits. "Previous" and "Next" are only the default children; the built-in aria-label is what a screen reader reads, and an sr-only child is belt-and-braces, overridden by it โ€” the arrows are then square, on the same icon size the numbered links use.

asChild renders the single child in place of the a, keeping every style โ€” this is how a page link becomes a next/link and stops reloading the document on every page change. The package depends on no framework and imports none, so the host supplies the component; AppLink below stands in for whatever yours is called. It works on PaginationLink, and โ€” since @OCE-1871 wrapped each arrow's label in Slottable โ€” on PaginationPrevious/PaginationNext directly too, so the arrows below take a router link exactly like the numbered pages do, with no need to hand-compose a chevron and a label around it yourself.

Scrolled to the current page

A long rail scrolls, and the page a reader is on has to be the one they can see. Every part here forwards a ref, where upstream forwards on only two โ€” so the current link can be measured against its container and centred without wrapping it in a spare div to get a node.

Under a table, and translated

DataTable does not compose Pagination โ€” its rows are whatever the caller decided to show, so the rail is a sibling beneath the grid and the caller owns the join. The words are defaults, not assertions: pass children and "Previous"/"Next" become whatever the surface needs, which is the only reason a rail is usable outside English.

Contacts
  • Marta FerreiraNorthwind OpsReplied
  • Daniel OseiCobalt FreightEnrolled
  • Ines LundHarbour SystemsReplied
  • Tomas RehakDelta LabsBounced
101โ€“104 of 412

API Reference

See the Pagination API page for every prop of every part, with types, defaults and the contract that pins them.

On this page