ZUI

Search documentation

Find a page or a heading.

Pagination

The pages of a long list, with the current page marked and links to the previous and next.

Installation

bash

The CLI writes components/ui/pagination.tsx, installs Direction, Button, Icon and Utils, and adds lucide-react-native.

Usage

tsx
tsx

API reference

Pagination

Takes every prop of React Native's View. It is a navigation landmark named Pagination, centred in its row; pass aria-label to name it otherwise.

PaginationContent, PaginationItem

Each takes every prop of React Native's View. PaginationContent is a list laid out in a row, and each PaginationItem is a listitem.

Takes every prop of Button but variant, plus:

It is announced as a link, and onPress navigates. The current page, isActive, is outlined, announced as selected on iOS and Android, and carries aria-current="page" on the web; the others are ghost. Its number goes in as a Text child.

PaginationPrevious, PaginationNext

Each takes the props of PaginationLink but children. They draw a chevron, named Go to previous page and Go to next page.

PaginationEllipsis

Takes every prop of React Native's View. It draws three dots for the pages left out, and is hidden from screen readers.

Right to left

The previous and next chevrons are mirrored when Direction says text reads right to left, so each points the way it goes, as upstream's cn-rtl-flip does.

Differences from upstream

  • Upstream's Previous and Next show a label from the sm breakpoint up and the chevron alone below it. A phone is below it, so the native ones draw the chevron alone and take no text.
  • iOS and Android have no current-page state, so a screen reader there announces the current page as a selected link. On the web it carries aria-current="page", as upstream's does.
  • Upstream renders each link as an anchor with an href. The native link navigates through onPress.