Pagination
<Pagination>TailwindCSS ModulesProduction StableNavigate large collections with numbered pages, record summaries, and optional page-size controls. A controlled component for tables, search results, and activity feeds.
npx coloxo add pagination --style coloxo-cssimport { Pagination } from '@coloxo/ui';Design Tokens:
2. Boundary states
Navigation controls disable at the edges of a collection. Try moving between pages to see the available actions change.
First page
Last page
Single page
Empty collection
3. Page size & custom labels
Provide onPageSizeChange to show the Rows selector. Reset the current page when the size changes so the next view starts at the beginning.
Adjustable results per page
4. Interactive Props Configurator
import { useState } from "react";import { Pagination } from "@coloxo/ui";export function PaginatedResults() { const [page, setPage] = useState(1); const [pageSize, setPageSize] = useState(10); return ( <Pagination page={page} pageSize={pageSize} total={120} onPageChange={setPage} onPageSizeChange={(size) => { setPageSize(size); setPage(1); }} /> );}5. Dark theme
The same navigation controls use semantic colors for dark dashboard surfaces.
Standard navigationExtended navigation6. Enterprise layout compositions
Keep pagination close to the collection it controls. This invoice list updates its visible records as you navigate.
Recent invoices
Billing activity across your workspace
| Invoice | Customer | Amount |
|---|---|---|
| INV-1041 | Acme Studio | $240.00 |
| INV-1042 | Orbit Analytics | $325.00 |
| INV-1043 | Northstar Labs | $410.00 |
| INV-1044 | Atlas Cloud | $495.00 |
Accessibility
Use Tab to focus page controls and Enter or Space to activate them. Unavailable previous, next, first, and last controls are disabled.
The navigation landmark is labeled Pagination. The selected page uses aria-current="page" to identify your position.
Arrow buttons have accessible names, and the page-size selector has a Rows label. Keep the visible record summary specific to your collection.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| page | number | — | Current page number, starting at 1. Required. |
| pageSize | number | — | Number of records per page. Required; use a positive number. |
| total | number | — | Total number of records across all pages. Required. |
| onPageChange | (page: number) => void | — | Required callback for page navigation. Update the controlled page value. |
| onPageSizeChange | (pageSize: number) => void | — | Shows the Rows selector when provided. Update pageSize and reset page to 1 in this callback. |
| pageSizeOptions | number[] | [10, 20, 50] | Available sizes in the Rows selector. |
| showFirstLast | boolean | false | Show shortcuts to the first and last pages. |
| metaLabel | string | ((meta: { start: number; end: number; total: number }) => string) | "Showing {start}–{end} of {total}" | Record summary template or formatter. Templates support {start}, {end}, and {total} placeholders. |
| className | string | — | Additional CSS classes applied to the navigation container. |