Default
import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function Default() {
const [page, setPage] = useState(1);
return <PixelPagination page={page} total={10} onChange={setPage} />;
}Windowed page-number navigator with Prev/Next, ellipses, and first/last anchors for navigating long paginated collections.
import { PixelPagination } from '@pxlkit/ui-kit';| Prop | Type | Default | Description |
|---|---|---|---|
page (required) | number | — | Current page (1-indexed). |
total (required) | number | — | Total number of pages. |
onChange (required) | (next: number) => void | — | Fires when the user picks a new page. |
siblings | number | 1 | Sibling pages to show around the current. Defaults to 1. |
surface | 'pixel' | 'linear' | — | Visual surface treatment override. |
ariaLabel | string | 'Pagination' | Accessible label for the nav region. |
prevLabel | string | 'Prev' | Localised label for the Prev button. |
nextLabel | string | 'Next' | Localised label for the Next button. |
ref points to its element (HTMLElement).
WCAG target: 2.1 AA
navigationRendered as a <nav> landmark with a configurable aria-label. The current page button carries aria-current="page"; ellipses are aria-hidden so screen readers skip decorative gaps. Prev/Next buttons disable at the edges instead of being removed, preserving layout and predictable tab order.
| Key | Action | When |
|---|---|---|
| Tab | Moves focus through Prev, page buttons, and Next. | — |
| Enter | Activates the focused page or Prev/Next button. | — |
| Space | Activates the focused page or Prev/Next button. | — |
import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function Default() {
const [page, setPage] = useState(1);
return <PixelPagination page={page} total={10} onChange={setPage} />;
}import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function Default() {
const [page, setPage] = useState(1);
return <PixelPagination page={page} total={10} onChange={setPage} />;
}import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function ManyPages() {
const [page, setPage] = useState(5);
return <PixelPagination page={page} total={50} onChange={setPage} />;
}import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function MidWindow() {
const [page, setPage] = useState(10);
return <PixelPagination page={page} total={20} onChange={setPage} />;
}import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function MoreSiblings() {
const [page, setPage] = useState(8);
return <PixelPagination page={page} total={20} onChange={setPage} siblings={2} />;
}import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function PixelSurface() {
const [page, setPage] = useState(3);
return <PixelPagination page={page} total={12} onChange={setPage} surface="pixel" />;
}import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function LinearSurface() {
const [page, setPage] = useState(3);
return <PixelPagination page={page} total={12} onChange={setPage} surface="linear" />;
}import { useState } from 'react';
import { PixelPagination } from '@pxlkit/ui-kit';
export function LocalisedLabels() {
const [page, setPage] = useState(2);
return (
<PixelPagination
page={page}
total={8}
onChange={setPage}
prevLabel="Anterior"
nextLabel="Siguiente"
ariaLabel="Paginación"
/>
);
}import { PixelPagination } from '@pxlkit/ui-kit';
export function FirstPage() {
return <PixelPagination page={1} total={10} onChange={() => {}} />;
}import { PixelPagination } from '@pxlkit/ui-kit';
export function LastPage() {
return <PixelPagination page={10} total={10} onChange={() => {}} />;
}import { PixelPagination } from '@pxlkit/ui-kit';
export function SinglePage() {
return <PixelPagination page={1} total={1} onChange={() => {}} />;
}