Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by shadcn
Edit on GitHub

Pagination

Pagination with page navigation, next and previous links.

Powered by

Installation

bash
npx shadcn@latest add @redpanda/pagination
bash
pnpm dlx shadcn@latest add @redpanda/pagination
bash
yarn dlx shadcn@latest add @redpanda/pagination
bash
bunx shadcn@latest add @redpanda/pagination
bash
nubx shadcn@latest add @redpanda/pagination
bash
aube dlx shadcn@latest add @redpanda/pagination

When to use

Pagination components help users navigate through large datasets by breaking content into manageable pages. Use this decision tree to determine when it’s appropriate:

Usage

tsx
import {  Pagination,  PaginationContent,  PaginationEllipsis,  PaginationItem,  PaginationLink,  PaginationNext,  PaginationPrevious,  SimplePagination,} from '@/components/ui/pagination';
tsx
<Pagination>  <PaginationContent>    <PaginationItem>      <PaginationPrevious href="#" />    </PaginationItem>    <PaginationItem>      <PaginationLink href="#">1</PaginationLink>    </PaginationItem>    <PaginationItem>      <PaginationEllipsis />    </PaginationItem>    <PaginationItem>      <PaginationNext href="#" />    </PaginationItem>  </PaginationContent></Pagination>

Examples

Default

Card

Simple Pagination

A higher-level component that provides smart pagination with ellipsis handling.

SimplePagination Props

Prop Type Default Description
currentPage number - The current active page (required)
totalPages number - Total number of pages (required)
onPageChange (page: number) => void - Callback when page changes
showEllipsis boolean true Whether to show ellipsis (…)
maxVisiblePages number 5 Maximum number of page buttons to show
className string - Additional CSS classes

Usage

tsx
import { SimplePagination } from '@/components/ui/pagination';
function MyComponent() {  const [currentPage, setCurrentPage] = useState(1);  const totalPages = 20;
  return <SimplePagination currentPage={currentPage} totalPages={totalPages} onPageChange={setCurrentPage} />;}

Next.js

By default the <PaginationLink /> component will render an <a /> tag.

To use the Next.js <Link /> component, make the following updates to pagination.tsx.

diff
+ import Link from "next/link"
- type PaginationLinkProps = ... & React.ComponentProps<"a">+ type PaginationLinkProps = ... & React.ComponentProps<typeof Link>
const PaginationLink = ({...props }: ) => (  <PaginationItem>-   <a>+   <Link>      // ...-   </a>+   </Link>  </PaginationItem>)

Credits

  • We take our inspiration from Shadcn UI for the pagination component and style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?