datui
Color scheme

Navigation

Pagination

Page navigation with previous/next buttons, boundary and sibling pages and ellipses.

import { Pagination } from "datui";

Playground

<Pagination totalPages={20} siblingCount={1} boundaryCount={1} navigationButtonsStyle="icon" />

Examples

Controlled

siblingCount and boundaryCount control how many pages are shown around the current one and at the ends.

renderPageButton/renderNavigationButton render your own elements, e.g. router links.

Accessibility

  • A <nav> labelled by a visually hidden heading (navigationLabel, default "Pages").
  • Page buttons are named "Page N" (customize with getPageLabel); the current one has aria-current="page".
  • Previous/next are disabled on the first/last page and named by prevButtonLabel/nextButtonLabel; visible captions are hidden from assistive tech to avoid double reading.
  • Ellipses are aria-hidden.

API

Pagination

Page navigation with previous/next buttons, boundary and sibling pages and ellipses.

PropTypeDefaultDescription
boundaryCountnumber1Pages always shown at each end.
classNamestring—
currentPagenumber—Current page (1-based). Leave undefined to let the component track it.
defaultCurrentPagenumber1Initial page when uncontrolled.
disabledbooleanfalse
getPageLabel((page: number, isCurrent: boolean) => string)(page) => `Page ${page}`Accessible name of a page button.
navigationButtonsStyle"caption" | "both" | "icon"icon
navigationLabelstringPagesHidden heading that labels the navigation landmark.
nextButtonCaptionstringNext
nextButtonLabelstringNext page
onChange((page: number, event: MouseEvent<HTMLElement, MouseEvent>) => void)—
prevButtonCaptionstringPrevious
prevButtonLabelstringPrevious page
renderNavigationButton((props: PaginationNavigationRenderProps) => ReactNode)—
renderPageButton((props: PaginationPageRenderProps) => ReactNode)—Render a page button yourself, e.g. as a router link. Spread the props onto it.
siblingCountnumber1Pages shown on each side of the current one.
totalPagesnumber1