Pagination
Pagination navigation for paged data views.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import from the focused entry point below, or use the same named export from @tavojs/ui. Both are public APIs; measure the built application when comparing their bundle cost.
tsximport { Pagination } from "@tavojs/ui/pagination";The component import loads compiled component CSS. Enable tavoUi() for your project theme variables, or import @tavojs/ui/theme.css once for the package default theme. The equivalent CSS-safe component alias is @tavojs/ui/css/pagination.
When to use
Use it when
Choose something else when
Examples
These examples include imports and local state where interaction requires it. Render the exported component in a page after completing UI installation. Demo state stays in the mounted component; connect file handling, persistence, and data loading to your application as needed.
Pagination example
tsximport { createTavo } from "@tavojs/core";
import { Pagination } from "@tavojs/ui/pagination";
import { Text } from "@tavojs/ui";
type State = { page: number };
export const PaginationExample1 = createTavo<Record<string, never>, State>({
model: () => ({ page: 1 }),
view: ({ state, model }) => (
<>
<Pagination page={state.page} pageCount={12} onChange={(page) => model.set("page", page)} />
<Text>Current page: {state.page}. Load or filter records using this value.</Text>
</>
)
});Common props and defaults
A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.
| 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 | Use page to supply rendered state. Update it through the documented callback or native event handler. |
| 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 |