Make your AI a shadcn expert

Shadcn Pagination

React pagination for search results and data tables. Built with TypeScript and Tailwind CSS for Next.js using Base UI — previous, next, page links, and ellipsis.

Pagination is a nav of page links. Previous, a few numbers, an ellipsis when the range is long, and next. Use it under a table, a catalog, or search results when each page should have its own URL.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same pagination, thicker borders. The NeoBrutalism pagination is the kit if you want that look.

Usage

import {
  Pagination,
  PaginationContent,
  PaginationEllipsis,
  PaginationItem,
  PaginationLink,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"
<Pagination>
  <PaginationContent>
    <PaginationItem>
      <PaginationPrevious href="?page=1" />
    </PaginationItem>
    <PaginationItem>
      <PaginationLink href="?page=1">1</PaginationLink>
    </PaginationItem>
    <PaginationItem>
      <PaginationLink href="?page=2" isActive>
        2
      </PaginationLink>
    </PaginationItem>
    <PaginationItem>
      <PaginationLink href="?page=3">3</PaginationLink>
    </PaginationItem>
    <PaginationItem>
      <PaginationEllipsis />
    </PaginationItem>
    <PaginationItem>
      <PaginationNext href="?page=3" />
    </PaginationItem>
  </PaginationContent>
</Pagination>

isActive is the current page — outline variant and aria-current="page".

Composition

PaginationPrevious
PaginationLink

Simple

Page numbers only. No previous, no next — just the range they can see.

Scroll to load preview...

Icons Only

Previous and next, no numbers. Pair it with a rows-per-page Select under a data table.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Previous / Next copy lives in the component file.

Scroll to load preview...

API

Pagination is a nav with aria-label="pagination". Override the label if two pagers share the page.

Prop

Type

PaginationPrevious and PaginationNext are PaginationLinks with size="default" and hardcoded Previous / Next labels. PaginationEllipsis is a span with a more-pages icon.

Notes

You own the page math

This is markup. Compute which numbers to show. Do not render Previous on page 1, or Next on the last page — the buttons do not disable themselves.

PaginationLink is an <a>. Swap it for Next.js Link in pagination.tsx if you want client navigation.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.