Pagination
Page-by-page navigation.
total is the number of pages. Use defaultPage when uncontrolled, or page with onChange for controlled mode. siblings sets how many neighbouring pages are visible around the current one; the rest collapse into an ellipsis. Set prevAriaLabel and nextAriaLabel for the previous and next buttons in the interface language.
Live example
Example controls
Usage
'use client';
import { Pagination } from '@prosazhin/pbcomponents';
import { useState } from 'react';
function Example() {
const [page, setPage] = useState(1);
return (
<Pagination
total={20}
page={page}
onChange={setPage}
/>
);
}Component API
| Prop | Type / variants | Purpose | Default |
|---|---|---|---|
total | number | Number of pages. | — |
page | number | Current page in controlled mode. | — |
defaultPage | number | Initial page when uncontrolled. | 1 |
onChange | (page: number) => void | Called when the page changes. | — |
siblings | number | How many neighbouring pages to show around the current one. | 1 |
size | 'xs' | 's'xs · s | Button size. | s |
prevAriaLabel | string | Accessible name of the previous button. | Previous page |
nextAriaLabel | string | Accessible name of the next button. | Next page |
className | string | Class of the root element. | — |
Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.