Pagination
Pagination navigation for paged data views.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
tsximport { Pagination } from "@tavojs/ui/pagination";Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/pagination.
When to use
Use it when
Choose something else when
Examples
Pagination example
tsximport { Pagination } from "@tavojs/ui/pagination";
export function PaginationExample1() {
const setPage = (_page: number) => undefined;
return (
<>
<Pagination page={2} pageCount={12} onChange={setPage} />
<Pagination page={2} pageCount={12} getHref={(page) => `/docs?page=${page}`} />
</>
);
}Common props and defaults
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
page | number | Required | Configures page for this component. |
pageCount | number | Required | Configures pageCount for this component. |
siblingCount | number | — | Configures siblingCount for this component. |
onChange | (page: number) => void | — | Configures onChange for this component. |
getHref | (page: number) => string | — | renders page and control actions as links when provided. |
label | string | — | Configures label for this component. |
Complete TypeScript API
Import from @tavojs/ui/pagination. Published exports: Pagination, PaginationProps.
PaginationProps
| Property | Type | Required | Description |
|---|---|---|---|
children | import("/Users/hrach/Documents/Projects/Codex/tavo-ui-monorepo/node_modules/@tavojs/core/dist/jsx").Child | No | Inherited children attribute accepted by Pagination. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
id | string | No | Inherited id attribute accepted by Pagination. |
page | number | Yes | Configures page for this component. |
pageCount | number | Yes | Configures pageCount for this component. |
siblingCount | number | No | Configures siblingCount for this component. |
onChange | (page: number) => void | No | Configures onChange for this component. |
getHref | (page: number) => string | No | renders page and control actions as links when provided. |
label | string | No | Configures label for this component. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | Application controlled through page and the matching callback. |
| DOM target | Public passthrough props target the component root. Treat nested elements and private class names as implementation details. |
Anatomy and related components
Limitations
Avoid Pagination when using data components as decorative layout containers.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Uses `nav`, `aria-label`, and `aria-current`.
Uses `nav`, `aria-label`, and `aria-current`.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | data |
| Component import | @tavojs/ui/pagination |
| Explicit CSS import | @tavojs/ui/css/pagination |
| Preview | Interactive preview available on this page |