Display & Navigation · Paginationstable
Pagination
Page navigation for long lists and tables, with numbered or compact controls, a row-count details line and a rows-per-page select.
Preview
#previewSwitch variant, page count, details and page size, then click through the pages. Show code opens the React and CSS below.
variant numbers · 24 pages
pagination-example.tsx
import { Pagination } from "@blade-ai/weft/components/pagination";
export function OrdersPagination({ page, setPage }: Props) {
return (
<Pagination
page={page}
pageCount={24}
onPageChange={setPage}
/>
);
}All states
#all-statesVariants and page positions. Item hover, focus and pressed come from interaction; the component does not expose a forced-state prop.
Numbers · first page
Numbers · middle (both ellipses)
Numbers · last page
Numbers · near start
Numbers · few pages
Compact
Showing 11–20 of 240
With details
Showing 11–20 of 240
With rows per page
Showing 11–20 of 240
Compact · with details
Props
#propsThe app owns page and pageSize. Previous and Next disable at the ends.
Prop
Type
Default
Description
page *
number
—
1-based current page.
pageCount *
number
—
Total number of pages.
onPageChange *
(page: number) => void
—
Fires with the new page from a page, Previous or Next press.
variant
"numbers" | "compact"
"numbers"
numbers: Previous, page buttons with ellipsis, Next. compact: Previous, "Page 2 of 24", Next.
totalItems
number
—
Total row count. With pageSize it renders the "Showing 11–20 of 240" details line.
pageSize
number
—
Rows per page.
pageSizeOptions
number[]
—
Row-count choices. When set (with onPageSizeChange) the "Rows per page" select shows.
onPageSizeChange
(pageSize: number) => void
—
Fires with the chosen row count.
accessibilityLabel
string
"Pagination"
Accessible name of the nav landmark.
className
string
—
Extra classes on the root.
Usage
#usageShort rules for using pagination.
Do
Use it when a list is too long for one screen.
Show the details line so people know the total.
Reset to page 1 when filters or page size change.
Use compact where width is tight, such as mobile.
Don't
Don't use it for a handful of rows.
Don't hide Previous and Next at the ends; they disable.
Don't use it for steps in a flow; use Stepper.
Don't paginate and infinite-scroll the same list.
Accessibility
#accessibilityA nav landmark with real buttons. The current page carries aria-current.
Keyboard
Key
Action
Tab / Shift+Tab
Moves between Previous, page buttons, Next and the rows-per-page select.
Enter / Space
Activates the focused page, Previous or Next.
Arrow keys
On the select, changes the row count.
ARIA
Element
Role / attribute
When
Container
<nav>, aria-label
Always; label from accessibilityLabel.
Page button
aria-label="Page N", aria-current="page"
aria-current only on the current page.
Previous / Next
disabled
On the first and last page.
Compact label
aria-live="polite"
Announces the new page.
Ellipsis
aria-hidden="true"
Always; decorative.