Skip to content
Playground

Pagination

Page navigation primitives and a stateful controls convenience component.

Page navigation primitives and a stateful controls convenience component.

Page 2 of 8

TSX
import { Pagination } from "@zentara-co/zenos-ui";

Pagination.Controls calculates a compact sequence and reports the requested page. The application remains responsible for fetching or revealing the corresponding content.

TSX
const [page, setPage] = useState(1); <Pagination.Controls currentPage={page} totalPages={12} onPageChange={setPage} />;

Pass pageSize and onPageSizeChange when a table should let someone choose how many rows appear. The select stays hidden without those props. pageSizeOptions defaults to 10, 20, 50, and 100. pageSizeSide places the select at start or end of the page buttons, and defaults to start. The older left and right values remain compatible aliases. Recompute totalPages from the new size in onPageSizeChange, and return to page 1 when the previous page would no longer exist.

Previous and Next disable automatically at the first and last page. Set showDirectionText when the surrounding width can accommodate explicit labels.

The built-in chevrons mirror in RTL. Keep custom previous and next icons direction-aware when replacing them.

Use the compound parts when routing, custom page ranges, or custom direction controls make the convenience component unsuitable.

Use className on Pagination.Controls to style the navigation surface. Its stable data-slot attributes can target page and direction buttons, while data-active identifies the current page. Keep the existing aria-current, disabled, hover, and focus-visible behavior intact when changing the visual treatment.

Page 3 of 8

Pagination.Root
Pagination.Content
Pagination.Item
Pagination.Page
Pagination.Previous
Pagination.Next
Pagination.Ellipsis
Pagination.Controls

API

PropTypeDefaultDescription
currentPage number — Controlled 1-based current page on Controls.
totalPages number — Available page count.
onPageChange (page: number) => void — Runs after navigation.
showDirectionText boolean false Shows Previous and Next labels on Controls.
pageSize number — Selected rows per page. Omit with onPageSizeChange to hide the select.
pageSizeOptions number[] [10, 20, 50, 100] Options in the page-size select.
onPageSizeChange (pageSize: number) => void — Runs when a page size is chosen. Presence of this callback shows the select.
pageSizeLabel ReactNode Rows per page Visible label for the page-size select.
pageSizeSide start | end | left | right start Places the page-size select at a logical edge. Left and right remain compatible aliases.
isActive boolean false Marks Pagination.Page as the current page.
showText boolean true Shows text on Previous and Next compound controls.
icon ReactNode — Replaces a Previous or Next chevron.
getPaginationPages (currentPage, totalPages) => PaginationPageEntry[] — Returns the compact page and ellipsis sequence used by Controls.

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

Pagination renders a labelled navigation landmark containing native buttons. The current page uses aria-current="page", and direction controls retain accessible names when their visible text is hidden. Give multiple paginations distinct aria-label values. After a page change, move focus or announce updated results when the content replacement would otherwise be unclear.