Skip to content
Porcelana

Pagination

Page buttons with ellipses and previous/next.

Navigation

Example

Example.tsx
import { useState } from "react";
import { Pagination } from "@porcelana/ui";

export default function Example() {
  const [page, setPage] = useState(5);
  return <Pagination page={page} pageCount={12} onPageChange={setPage} />;
}

Import

Import
import { Pagination } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Pagination

PropTypeDefaultDescription
onPageChangerequired(page: number) => void–Called with the 1-based page to show.
pagerequirednumber–Current page, 1-based.
pageCountrequirednumber–Total number of pages.
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
idstring–Element id. Generated automatically when omitted.
nextLabelstringNext pageAccessible name of the next button.
pageLabel((page: number) => string)(p) => `Page ${p}`Builds each page button's accessible name.
previousLabelstringPrevious pageAccessible name of the previous button.
siblingCountnumber1Pages shown on each side of the current one before an ellipsis.

Accessibility

  • A nav landmark named Pagination; the current page has aria-current="page".
  • Every button has a full name ("Page 5"); edge buttons disable at the ends.

Mobile

  • 44px buttons; siblingCount controls how many pages show around the current one.