Pagination
Move between pages of results.
Usage
Use links when each page has a URL. Set aria-current="page" on the active item.
Accessibility
Label page links and omit or disable unavailable previous and next actions.
| Property | Type | Default |
|---|---|---|
| aria-label | string | Pagination |
const Example = () => {
const [currentPage, setCurrentPage] = useState(2);
return (
<Pagination aria-label="Example pagination">
{[1, 2, 3].map((page) => (
<button
key={page}
type="button"
aria-label={`Page ${page}`}
aria-current={page === currentPage ? 'page' : undefined}
onClick={() => setCurrentPage(page)}
>
{page}
</button>
))}
</Pagination>
);
};