Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Many Pages Pagination for Ark UI

Pages 1 through 10 in one row, with page 5 marked current, and no Previous, Next, or ellipsis.

Ten page links sit in one row, from 1 to 10. Page 5 is current. They are rendered from a list of page numbers. Every href is #.

Use it only when every page fits on screen. Past about ten, collapse the middle with an ellipsis, or jump with a Select. In React, Ark UI does not trim the row for you.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

Pagination anatomy: root, previous, item, ellipsis, next

Usage

<Pagination>
  <PaginationContent>
    {pages.map((page) => (
      <PaginationItem key={page}>
        <PaginationLink href="#" isActive={page === 5}>
          {page}
        </PaginationLink>
      </PaginationItem>
    ))}
  </PaginationContent>
</Pagination>

FAQ

How are the ten links rendered?

The page numbers are a list, 1 to 10, mapped to one PaginationItem and PaginationLink each, keyed by the page number.

How is page 5 marked current?

isActive is true where the page equals 5, which gives that link the outline style and aria-current="page". Compare against your current page instead.

What if the row is too wide?

Ten links fit most screens; more don't. Collapse the middle with PaginationEllipsis, keeping the first, last and nearby pages.

Can Pagination generate the numbers for me?

Yes. Pass count and render PaginationItems. siblingCount and boundaryCount choose how many pages show beside the current one and at each end, and the gaps become PaginationEllipsis.

How do I add Previous and Next?

Put PaginationPrevious before the first number and PaginationNext after the last, each in its own PaginationItem.

How do I give each link a URL?

Every href is #. Build it from the page number, such as ?page= followed by the page.

API Reference

Pagination

Sets href="#" and isActive={page === 5}. The rest is on the Pagination page.