Examples

Controlled

Preview

Showing invoices 126–150 of 500

Example.tsx
import { Pagination, Stack, Text } from '@reactloom/ui';
import { useState } from 'react';

export default function Example() {
  const [page, setPage] = useState(6);
  return (
    <Stack gap="3" align="center">
      <Pagination pageCount={20} page={page} onPageChange={setPage} />
      <Text size="sm" tone="muted" role="status">Showing invoices {page * 25 - 24}–{page * 25} of 500</Text>
    </Stack>
  );
}

As links

Crawlable and router friendly.

Preview
Example.tsx
import { Pagination } from '@reactloom/ui';

export default function Example() {
  // Real links: crawlable, work without JavaScript, open in a new tab with ⌘/Ctrl-click.
  return <Pagination pageCount={8} defaultPage={3} size="sm" getHref={(page) => `?page=${page}`} />;
}

API reference

Pagination props
PropTypeDefault
pageCountrequired
number—
page / defaultPage
1-based.
number1
onPageChange
(page: number) => void—
siblingCount · boundaryCount
number1 · 1
getHref
Render links instead of buttons.
(page: number) => string—
size
'sm' | 'md''md'
labels
Translations.
{ previous?, next?, page?(n) }—

Customization

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-disabled]present when on
[data-size]sm · md

Theme tokens it reads

--pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-input --pl-color-fg-default --pl-color-fg-disabled --pl-color-fg-muted --pl-control-height-md --pl-control-height-sm --pl-focus-ring-color --pl-focus-ring-width --pl-font-size-md --pl-font-size-sm --pl-radius-md --pl-shadow-xs

Accessibility

  • A named nav landmark; the current page has aria-current="page".
  • Each control has a full label (“Page 5”, “Next page”); ellipses are hidden.
Keyboard interactions
KeyAction
TabMove between pages

Usage guidelines

Do

  • Show the range (“26–50 of 500”) next to it.

Don’t

  • Don’t paginate short lists.