Numbered Pagination
A numbered page strip that collapses long runs to an ellipsis.
6 frameworksIntermediate
A segmented group of page links joined by a shared border and hairline dividers.
<!--
One shared border on the group and divide-x hairlines between cells, so the
segments read as a single control. overflow-hidden clips the fill of the
current cell to the rounded corners; overflow-x-auto lets the strip scroll
rather than overflow the viewport if the range is wide on a narrow screen.
-->
<nav aria-label="Pagination" class="max-w-full overflow-x-auto">
<ul class="inline-flex list-none divide-x divide-gray-300 overflow-hidden rounded-lg border border-gray-300 p-0 dark:divide-gray-700 dark:border-gray-700">
<li><a href="?page=1" aria-current="page" class="inline-flex h-10 min-w-10 items-center justify-center bg-blue-600 px-3 text-sm font-semibold tabular-nums text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400">1</a></li>
<li><a href="?page=2" class="inline-flex h-10 min-w-10 items-center justify-center px-3 text-sm font-medium tabular-nums text-gray-700 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-600 motion-reduce:transition-none dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100">2</a></li>
<li><a href="?page=3" class="inline-flex h-10 min-w-10 items-center justify-center px-3 text-sm font-medium tabular-nums text-gray-700 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-600 motion-reduce:transition-none dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100">3</a></li>
<li><span class="inline-flex h-10 min-w-10 items-center justify-center px-3 text-sm text-gray-500 dark:text-gray-400" aria-hidden="true">…</span></li>
<li><a href="?page=10" class="inline-flex h-10 min-w-10 items-center justify-center px-3 text-sm font-medium tabular-nums text-gray-700 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-600 motion-reduce:transition-none dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100">10</a></li>
</ul>
</nav>| Prop | Type | Default | Description |
|---|---|---|---|
currentPagerequired | number | - | The active page number, starting at 1. |
totalPagesrequired | number | - | How many pages exist in total. |
buildHrefrequired | (page: number) => string | - | Builds the URL for a page number, so pages stay real links. |
siblingCount | number | 1 | How many page numbers to show either side of the current one. |
ariaLabel | string | 'Pagination' | The button's accessible name. Required for icon-only buttons. |
className | string | - | Additional classes merged onto the root element. |
One border wraps the whole group and `divide-x` draws the hairlines between cells, so the segments read as a single control rather than loose buttons; `overflow-hidden` clips the current cell fill to the rounded corners. The container scrolls (`overflow-x-auto`) instead of overflowing the viewport when the range is wide on a narrow screen. Focus rings are inset so they are not clipped by that same overflow.