Pagination
Previous and next controls around a stable-width page window
Deployments
The last 24 hours, five per page
- web-apipassed
- billingpassed
- search-indexrunning
- authpassed
- mediafailed
Rows 1–5 of 23
Installation
npx shadcn@latest add @sudokw/components-paginationimport { Pagination } from "@gpuixui/components";Usage
import { useState } from "react";
import {
Pagination,
PaginationList,
PaginationNext,
PaginationPrevious,
} from "@gpuixui/components/pagination";
const PAGE_SIZE = 5;
export const DeploymentPages = ({ deployments }: { deployments: string[] }) => {
const [page, setPage] = useState(1);
const pageCount = Math.ceil(deployments.length / PAGE_SIZE);
const rows = deployments.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
return (
<>
<DeploymentList rows={rows} />
<Pagination page={page} pageCount={pageCount} onPageChange={setPage}>
<PaginationPrevious />
<PaginationList />
<PaginationNext />
</Pagination>
</>
);
};Composition
Pagination
├── PaginationPrevious
├── PaginationList
│ ├── PaginationItem
│ └── PaginationEllipsis
└── PaginationNextAPI reference
| Part | Prop | Type | Default | Consequence |
|---|---|---|---|---|
Pagination | page | number (required) | — | the current page, 1-based; clamped into [1, pageCount] |
Pagination | pageCount | number (required) | — | pages that exist; zero or fewer renders nothing |
Pagination | onPageChange | (page: number) => void (required) | — | a step or a page press |
Pagination | siblingCount | number | 1 | pages shown either side of the current one |
Pagination | showEdges | boolean | true | keep the first and last page visible |
Pagination | children | parts | — | PaginationPrevious, PaginationList, PaginationNext |
PaginationItem | page | number (required) | — | the page this button goes to |
PaginationItem | style | StateStyle<PaginationItemState> | recipe | a style or a function of { active } |
PaginationPrevious / PaginationNext | — | — | — | step by one; disabled at their end |
PaginationList / PaginationEllipsis | className | string | — | an extra recipe class, joined last |
Edit this page on GitHubapps/docs/content/docs/components/pagination.mdx