Pagination
Pagination moves through large result sets with page and size controls.
@duskmoon-dev/components/pagination Usage
When to use
- Use it when users need to move between sections, pages, steps, or contextual actions.
- Expose current and disabled state so navigation remains clear to keyboard and screen-reader users.
Implementation notes
Features
Covers the route, section, step, or action-list patterns that help users move through an interface.
Shows selected, active, open, or current props where the component exposes them.
Pagination is most often configured through `current`, `defaultCurrent`, `pageSize`, `defaultPageSize`.
Renders total/current/pageSize parity state
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and Pagination from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function Example() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Renders total/current/pageSize parity state
test-backedPagination scenario from the component test coverage: renders total/current/pagesize parity state.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationRendersTotalCurrentPageSizeDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Calls onChange with page and pageSize when a page is clicked
test-backedPagination scenario from the component test coverage: calls onchange with page and pagesize when a page is clicked.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationCallsOnChangeWithPageDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Disables prev and next at pagination boundaries
test-backedPagination scenario from the component test coverage: disables prev and next at pagination boundaries.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationDisablesPrevAndNextDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Supports size and className
test-backedPagination scenario from the component test coverage: supports size and classname.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationSupportsSizeAndClassNameDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Renders simple mode with compact input controls
test-backedPagination scenario from the component test coverage: renders simple mode with compact input controls.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationRendersSimpleModeWithDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Renders showTotal with current item range
test-backedPagination scenario from the component test coverage: renders showtotal with current item range.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationRendersShowTotalWithCurrentDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Supports quick jumper
test-backedPagination scenario from the component test coverage: supports quick jumper.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationSupportsQuickJumperDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Supports page size changer
test-backedPagination scenario from the component test coverage: supports page size changer.
import "@duskmoon-dev/components/styles.css";
import { Pagination } from "@duskmoon-dev/components/pagination";
export function PaginationSupportsPageSizeChangerDemo() {
return (<Pagination total={120} current={1} pageSize={10} />);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Pagination total={120} current={1} pageSize={10} />
</div>
<div data-theme="moonlight">
<Pagination total={120} current={1} pageSize={10} />
</div> API
The API reference below lists every parsed exported type or interface for Pagination. Start with `current`, `defaultCurrent`, `pageSize`, `defaultPageSize` for common usage.
packages/components/src/components/pagination/Pagination.types.ts
Scenarios: packages/components/src/components/pagination/Pagination.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
current | number | No | current configures Pagination. |
defaultCurrent | number | No | defaultCurrent configures Pagination. |
pageSize | number | No | pageSize configures Pagination. |
defaultPageSize | number | No | defaultPageSize configures Pagination. |
total | number | No | total configures Pagination. |
onChange | (page: number, pageSize: number) => void | No | onChange configures Pagination. |
disabled | boolean | No | disabled configures Pagination. |
simple | boolean | No | simple configures Pagination. |
showSizeChanger | boolean | No | showSizeChanger configures Pagination. |
showQuickJumper | boolean | No | showQuickJumper configures Pagination. |
showTotal | PaginationShowTotal | No | showTotal configures Pagination. |
size | PaginationSize | No | size configures Pagination. |
"sm" | "md" | "lg" ( total: number, range: [number, number], ) => ReactNode