Skip to content

Pagination

A pagination with page navigation, next and previous links.

Installation

pnpm dlx shadcn@latest add @frontal-labs/pagination

Usage

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

API Reference

This is a custom component, not a Base UI wrapper.

Pagination

Root navigation container with role="navigation" and aria-label="pagination".

PaginationContent

Unordered list container for pagination items.

PaginationItem

Individual list item container.

Renders an <a> through the Button component. Accepts all standard anchor attributes.

The button variant is derived from isActive: the current page renders as outline, every other link as ghost. Without an explicit variant each link fell back to default (bg-primary), which is near-black in light mode — every page number rendered as a solid dark button and the current page was indistinguishable.

PaginationPrevious

Link to the previous page. Renders at size="default" with a chevron left icon and "Previous" text, and carries aria-label="Go to previous page".

PaginationNext

Link to the next page. Renders at size="default" with "Next" text and a chevron right icon, and carries aria-label="Go to next page".

PaginationEllipsis

Ellipsis indicator for skipped pages. Renders a horizontal-ellipsis icon and is marked aria-hidden.