☀️ Summer Sale: up to 40% off all templates for a limited time.Get the deal
Shadcnadmin.com

Search

Search dashboards, components and blocks

Shadcn Pagination Components

Pagination with page navigation, next and previous links. Built with Shadcn UI, Tailwind CSS, Next.js and React, compatible with both Radix UI and Base UI primitives. Typescript included.

Pagination 1

Pagination 2

Pagination 3

Pagination 4

Pagination 5

Pagination 6

Pagination 7

Pagination 8

Pagination 9

Pagination 10

Pagination 11

Pagination 12

Shadcn Pagination Examples: Page Navigation Done Right in React

Pagination splits long result sets into pages and gives users next, previous, and numbered links to move between them. The shadcn pagination component provides the full anatomy, previous and next controls, page links with an active state, and an ellipsis for collapsed ranges, as semantic nav markup styled with Tailwind CSS, making it a dependable react pagination component for tables and listings.

This page assembles 12 pagination examples, Pagination 1 through Pagination 12, including compact mobile layouts, icon-only arrows, page size selectors, total count summaries, and table footer bars. All examples ship in TypeScript and adapt to Next.js link-based or state-based navigation.

Key features

  • Semantic nav markup: The root renders a nav with aria-label pagination, so assistive technology identifies the region correctly.
  • Active page indication: PaginationLink accepts isActive, which sets aria-current and the outlined style for the current page.
  • Ellipsis for long ranges: PaginationEllipsis collapses distant pages so ranges like 1 through 40 stay compact.
  • Link or button behavior: Items render as anchors for URL-driven paging or as buttons when state drives the page.
  • Composable layout: Page size selects, result counts, and jump controls slot around the core list without fighting the styles.

Best practices

  • Reflect the page in the URL: Query param based paging keeps results shareable and lets the back button work as users expect.
  • Disable edges instead of hiding: Show previous as disabled on page one rather than removing it, so the layout never jumps.
  • Show context near boundaries: Always render the first and last page numbers around the ellipsis so users can jump to the ends.
  • Pick page sizes deliberately: Offer a small set like 10, 25, and 50 rows and persist the choice per user.
  • Consider infinite scroll carefully: Numbered pagination beats infinite scroll whenever users need to return to a specific position.

Common use cases

Table footers are the primary destination. A data table of orders pairs server-side paging with a pagination bar showing the range, a page size select, and the page links. Search results, blog archives, and product listings use the same anatomy with URL-based links for SEO friendly crawling.

Admin panels often combine the compact icon-only variant on mobile with the full numbered layout on desktop. The dashboards in our Next.js template collection wire this responsive switch into real order and customer tables.

Playing well with tables and lists

Beyond the table, pagination pairs with card grids and item lists anywhere the dataset exceeds one screen. Keeping the bar outside a scroll area ensures the controls stay visible while rows scroll, and a summary line such as showing 21 to 30 of 148 grounds users in the whole set.

Under the hood

No primitive library is involved. The component is accessible nav markup styled with Tailwind CSS and the shared button styles, as laid out in the shadcn/ui pagination docs, so these pagination examples slot into Radix UI and Base UI based projects alike. Because links are plain anchors by default, server rendered pages get crawlable page URLs for free.

FAQs

How do I hook shadcn pagination into Next.js routing?
Render each PaginationLink with an href that sets a page query parameter, then read searchParams in your server component to fetch that page. This keeps paging state in the URL and works without client JavaScript.
Does the pagination component require Radix UI or Base UI?
No. It is semantic nav and list markup styled with Tailwind CSS, with no primitive dependency, so it works unchanged in projects based on either Radix UI or Base UI.
How do I implement server-side pagination with a data table?
Send the page number and page size to your API, return the rows plus a total count, and derive the page list from the total. The pagination bar only renders the numbers, so any data source works.
When should I show an ellipsis in page numbers?
Collapse the middle once there are roughly more than seven pages. Keep the first page, the last page, and a window around the current page visible, with an ellipsis on each collapsed side.
Is numbered pagination better than infinite scroll?
For task-driven interfaces like admin tables, yes. Numbered pages preserve position, support sharing links, and make totals visible, while infinite scroll suits casual browsing feeds.