Pagination

Page navigation with sibling and boundary ellipsis logic, a spring-gliding active pill, numbers that roll as the window shifts, arrow-nudge prev/next controls, and a compact dots variant.

Preview

Pagination preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/pagination
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

total
number

Total number of pages (1-based).

—
page?
number

Controlled current page (1-based).

—
defaultPage?
number

Initial page for uncontrolled use.

1
onPageChange?
((page: number) => void)
—
siblings?
number

Pages shown on each side of the current page.

1
boundaries?
number

Pages always shown at the start and end.

1
variant?
"numbers" | "dots"

`numbers` renders page buttons; `dots` is a compact indicator row.

numbers
maxDots?
number

Most dots shown at once in the `dots` variant; the window follows the page.

7
showControls?
boolean

Render previous / next controls.

true
disabled?
boolean
false
aria-label?
string

Accessible name for the `<nav>` landmark.

Pagination
getPageLabel?
((page: number) => string)

Accessible name per page button.

(p) => `Page ${p}`
className?
string
—

Updated