Yugen UI

Pagination

Pagination splits long content into pages and lets people move between them quickly.

Always shows the first page, the last page and siblingCount pages around the current one; the rest collapse into “…”. The current page has a brand tint background and aria-current="page". Works controlled (page / onPageChange) or uncontrolled (defaultPage).

Import

Install from npm, copy the source into your project with @yugen-ui/cli or the shadcn CLI, or import directly when working in this repo.

TSX
// npm install yugen-uiimport { Pagination } from "yugen-ui";

Variants

Each tile is a standalone example: hover to copy, or press Code to see the source.

Page 1 of 20

Controlled

siblingCount & few pages

siblingCount={2} shows more pages on each side; with few pages, every page is shown.

Small, icons only

size="small" and showLabels={false} for compact data tables.

Usage

Do
  • Place Pagination right below the list or table it controls.
  • Keep it in a fixed position so people can click repeatedly without moving the mouse.
Don't
  • Don't use it for continuous content (feeds). Consider loading more items instead.
  • Don't show Pagination when there is only one page.

Props

Prop · TypeDefaultDescription
page / defaultPagenumberDefault: — / 1Current page, starting at 1.
pageCountnumberDefault: —Required. Total number of pages.
onPageChange(page: number) => voidDefault: —Called when another page is selected.
siblingCountnumberDefault: 1Pages shown on each side of the current page.
size"small" | "medium"Default: "medium"Buttons 24 / 32px.
showLabelsbooleanDefault: trueShows the “Previous” / “Next” labels.
disabledbooleanDefault: —Disables the whole control.

Messages

Text built into the component: labels, aria-labels, screen reader announcements.

English by default. Change it with the messages prop of YugenProvider, by the namespace below; messagesVi has the Vietnamese set. See Interface language.

messages.pagination

Key · TypeDefault (English)messagesVi
labelstring

aria-label mặc định của thẻ <nav>.

Default (English)"Pagination"messagesVi"Phân trang"
previousPagestring

aria-label nút trang trước.

Default (English)"Previous page"messagesVi"Trang trước"
nextPagestring

aria-label nút trang sau.

Default (English)"Next page"messagesVi"Trang sau"
previousstring

Chữ hiện cạnh mũi tên trang trước (showLabels).

Default (English)"Previous"messagesVi"Trước"
nextstring

Chữ hiện cạnh mũi tên trang sau (showLabels).

Default (English)"Next"messagesVi"Sau"
page(page: number) => string

aria-label của nút số trang.

Default (English)(page) => `Page ${page}`messagesVi(page) => `Trang ${page}`