Code

<!-- pearl-pagination.free.js: download it from the Install section below and host it with your site -->
<script src="/pearl-pagination.free.js" defer></script>

<pearl-pagination total="24" page="3" siblings="1" size="40" theme="light"></pearl-pagination>

<script>
  document.querySelector('pearl-pagination').addEventListener('change', (e) => {
    loadPage(e.detail.page);
  });
</script>

In context

A handful of pages — no gaps
Mint, the tightest window Pro

Install · Free Web Component

One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/pearl-pagination.json
2. Load it and use the element
HTML
<!-- pearl-pagination.free.js: download it from the Install section below and host it with your site -->
<script src="/pearl-pagination.free.js" defer></script>

<pearl-pagination total="24" page="3" siblings="1" size="40" theme="light"></pearl-pagination>

<script>
  document.querySelector('pearl-pagination').addEventListener('change', (e) => {
    loadPage(e.detail.page);
  });
</script>
3. React + TypeScript (optional)

The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:

TypeScript
// pearl-pagination.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'pearl-pagination': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      total?: number | string;
      page?: number | string;
      siblings?: number | string;
      size?: number | string;
      theme?: 'light' | 'dark';
      sound?: boolean | '';
    };
  }
}

Pro · React + TypeScript Pro

One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.

  • React component (controlled with page / onChange, or uncontrolled with defaultPage) with TypeScript types and the full source
  • Sunset, Mint and Mono tints, plus custom tints from Brand Fit
  • The vanilla Web Component with every tint, a demo page, README and license

Attributes & props

NameTypeDefaultDescription
total number1Number of pages (not rows): divide your row count by the page size and round up.
page number1The current page, from 1. Fires change with detail.page when the user picks another; the attribute follows.
siblings number1Pages shown on each side of the current one. The control always holds siblings × 2 + 5 places (first, last, two gaps and the window), so its width never changes while you page.
size number (px)40Diameter of one page; the type, the bead and the arrows scale with it.
aria-label string'Pagination'Accessible name of the navigation — name what is being paged when a screen has more than one.
theme 'light' | 'dark''light'For a light or a dark page; the component has no background of its own.
sound booleanoffA porcelain tap, higher when you move forward. Also on for everything inside an element with data-ui-sound="on".
tint Pro'aurora' | 'sunset' | 'mint' | 'mono' | object'aurora'Colours of the light around the bead, or a custom tint. Free build ships Aurora only.

A navigation landmark of real buttons: each page is labelled “Page 7”, the current one carries aria-current="page", and the previous / next arrows turn aria-disabled at the ends. With focus anywhere inside, Left and Right step a page (mirrored in right-to-left pages), Home and End jump to the first and the last — focus stays on the current page as the numbers change. The gaps are not buttons. The component only reports the page: fetch or slice your data in the change listener. For a short, known sequence of steps Pearl Steps reads better; pagination is for a list of unknown length. All CSS, no WebGL. Reduced motion swaps the roll for a fade and moves the bead at once.

More components