1. Documentation
  2. Navigation
  3. Pagination
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Pagination

Page numbers with a window around the current one, or a compact previous/next pair.

Loading documentation…

Breadcrumb< PreviousTreeNext >

Powered by heyo

On this page

UsageSiblingsCompactProperties
……
<Pagination page={page} pageCount={12} onPageChange={setPage} />

Pagination is fully controlled: it renders the window of page numbers around page, with ellipses where the run is broken, and calls onPageChange. It never owns the page itself, because the page almost always lives in the URL.

Usage

tsx
import { Pagination } from "@heyo-sh/heyo-ui";<Pagination page={page} pageCount={12} onPageChange={setPage} />;

Siblings

siblings is how many numbers sit on each side of the current page. Two is right for a wide table; one keeps the control narrow enough for a card footer.

……
……
<Pagination siblings={1} page={page} pageCount={20} onPageChange={setPage} /><Pagination siblings={3} page={page} pageCount={20} onPageChange={setPage} />

Compact

compact drops the numbers and keeps a previous/next pair with a counter between them. It is the right control under a narrow list, and on a phone.

4 / 12
<Pagination compact page={page} pageCount={12} onPageChange={setPage} />
Inside a table

DataTable has a footer slot made for this — put the pagination there and it shares the table's single ring.

Properties

pagenumberrequired

The current page, 1-based.

pageCountnumberrequired

How many pages there are in total.

onPageChange(page: number) => voidrequired

Fires with the requested page.

siblingsnumberoptional

How many page buttons to show on each side of the current one.

compactbooleanoptional

Drops the numbers and keeps previous/next plus a counter.

classNamestringoptional

Merged into the <nav>.