Navigated to /docs/ui/components/pagination

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.

TSX
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

Use `Pagination` for paginated data

Choose something else when

Avoid Pagination when using data components as decorative layout containers.

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

TSXCreate: src/components/examples/PaginationExample1.tsx
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.

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
pagenumber

Required

Configures page for this component.
pageCountnumber

Required

Configures pageCount for this component.
siblingCountnumber

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.
labelstring

Configures label for this component.

Complete TypeScript API

Import from @tavojs/ui/pagination. Published exports: Pagination, PaginationProps.

PaginationProps

PropertyTypeRequiredDescription
childrenimport("/Users/hrach/Documents/Projects/Codex/tavo-ui-monorepo/node_modules/@tavojs/core/dist/jsx").Child

No

Inherited children attribute accepted by Pagination.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

idstring

No

Inherited id attribute accepted by Pagination.

pagenumber

Yes

Configures page for this component.

pageCountnumber

Yes

Configures pageCount for this component.

siblingCountnumber

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.

labelstring

No

Configures label for this component.

State ownership and DOM target

ConcernContract
StateUse page to supply rendered state. Update it through the documented callback or native event handler.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

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

ContractCurrent value
Maturitystable
Categorydata
Component import@tavojs/ui/pagination
Explicit CSS import@tavojs/ui/css/pagination
PreviewInteractive preview available on this page