Pagination
Page navigation primitives and a stateful controls convenience component.
Page navigation primitives and a stateful controls convenience component.
Page 2 of 8
Import
Section titled “Import”import { Pagination } from "@zentara-co/zenos-ui";Controlled pages
Section titled “Controlled pages”Pagination.Controls calculates a compact sequence and reports the requested page. The application remains responsible for fetching or revealing the corresponding content.
const [page, setPage] = useState(1); <Pagination.Controls currentPage={page} totalPages={12} onPageChange={setPage} />;Page size
Section titled “Page size”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.
Boundaries and direction labels
Section titled “Boundaries and direction labels”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.
First page
Last page
Compound composition
Section titled “Compound composition”Use the compound parts when routing, custom page ranges, or custom direction controls make the convenience component unsuitable.
Custom styling
Section titled “Custom styling”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
| Prop | Type | Default | Description |
|---|---|---|---|
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-*.
Accessibility
Section titled “Accessibility”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.