Pagination v0.1.0 Navigation

Page navigation with sibling windows and ellipsis collapsing (logic lives in latticeui-core).

import { Pagination } from "latticeui-react";

Examples

Basic

page: 3
Show code
<Pagination count={10} defaultPage={3} onPageChange={setPage} />

Many pages

Distant ranges collapse into ellipses; siblings controls the window width.

Show code
<Pagination count={50} defaultPage={25} siblings={2} />

Anatomy

These data-part attributes are a versioned public API - style and test against them; they will not change in a minor release.

PartElementStable selector
rootnav[data-scope="pagination"][data-part="root"]
listul[data-scope="pagination"][data-part="list"]
itembutton[data-scope="pagination"][data-part="item"]
ellipsisspan[data-scope="pagination"][data-part="ellipsis"]
prevbutton[data-scope="pagination"][data-part="prev"]
nextbutton[data-scope="pagination"][data-part="next"]

Props

PropTypeDefaultDescription
count *numberTotal pages.
page / defaultPagenumber
onPageChange(page: number) => void
siblingsnumber1

Accessibility

Roles: navigation

Styling

Override styles by targeting the stable selectors below from any unlayered CSS - it always beats the library's @layer latticeui styles, no !important needed.

[data-scope="pagination"][data-part="item"] {
  /* your overrides */
}

State attributes: aria-current="page"