DmPagination
DmPagination documents the DmPagination export from duskmoon.
@duskmoon-dev/components/dm-pagination Usage
When to use
- Use it in DuskMoon application screens that need a packaged, opinionated workflow component.
- Reach for the lower-level standard component when the screen needs custom composition.
Implementation notes
Features
Wraps lower-level primitives into a higher-level DuskMoon-prefixed workflow API.
Examples show the defaults and composition points expected by internal DuskMoon app screens.
DmPagination is most often configured through `selectedTotal`, `refresh`, `showRefresh`, `showPagination`.
Renders workflow total, selected count, pager, refresh, and alignment
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 DmPagination from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { DmPagination } from "@duskmoon-dev/components/dm-pagination";
export function Example() {
return (<DmPagination total={120} current={1} pageSize={10} />);
} Renders workflow total, selected count, pager, refresh, and alignment
test-backedDmPagination scenario from the component test coverage: renders workflow total, selected count, pager, refresh, and alignment.
import "@duskmoon-dev/components/styles.css";
import { DmPagination } from "@duskmoon-dev/components/dm-pagination";
export function DmPaginationRendersWorkflowTotalSelectedDemo() {
return (<DmPagination total={120} current={1} pageSize={10} />);
} Calls refresh and supports loading state
test-backedDmPagination scenario from the component test coverage: calls refresh and supports loading state.
import "@duskmoon-dev/components/styles.css";
import { DmPagination } from "@duskmoon-dev/components/dm-pagination";
export function DmPaginationCallsRefreshAndSupportsDemo() {
return (<DmPagination total={120} current={1} pageSize={10} />);
} Can render refresh only or hide entirely
test-backedDmPagination scenario from the component test coverage: can render refresh only or hide entirely.
import "@duskmoon-dev/components/styles.css";
import { DmPagination } from "@duskmoon-dev/components/dm-pagination";
export function DmPaginationCanRenderRefreshOnlyDemo() {
return (<DmPagination total={120} current={1} pageSize={10} />);
} Keeps primitive pagination callbacks and custom locale
test-backedDmPagination scenario from the component test coverage: keeps primitive pagination callbacks and custom locale.
import "@duskmoon-dev/components/styles.css";
import { DmPagination } from "@duskmoon-dev/components/dm-pagination";
export function DmPaginationKeepsPrimitivePaginationCallbacksDemo() {
return (<DmPagination total={120} current={1} pageSize={10} />);
} Forwards the wrapper ref
test-backedDmPagination scenario from the component test coverage: forwards the wrapper ref.
import "@duskmoon-dev/components/styles.css";
import { DmPagination } from "@duskmoon-dev/components/dm-pagination";
export function DmPaginationForwardsTheWrapperRefDemo() {
return (<DmPagination 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">
<DmPagination total={120} current={1} pageSize={10} />
</div>
<div data-theme="moonlight">
<DmPagination total={120} current={1} pageSize={10} />
</div> API
The API reference below lists every parsed exported type or interface for DmPagination. Start with `selectedTotal`, `refresh`, `showRefresh`, `showPagination` for common usage.
packages/components/src/components/dm-pagination/DmPagination.types.ts
Scenarios: packages/components/src/components/dm-pagination/DmPagination.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
selectedTotal | number | No | selectedTotal configures DmPagination. |
refresh | () => void | No | refresh configures DmPagination. |
showRefresh | boolean | No | showRefresh configures DmPagination. |
showPagination | boolean | No | showPagination configures DmPagination. |
loading | boolean | No | loading configures DmPagination. |
wrapperStyle | CSSProperties | No | wrapperStyle configures DmPagination. |
align | DmPaginationAlign | No | align configures DmPagination. |
showTotalFullMessage | boolean | No | showTotalFullMessage configures DmPagination. |
responsiveSimple | boolean | No | responsiveSimple configures DmPagination. |
locale | DmPaginationLocale | No | locale configures DmPagination. |
showTotal | PaginationShowTotal | No | showTotal configures DmPagination. |
| Prop | Type | Required | Description |
|---|---|---|---|
refresh | string | No | refresh configures DmPagination. |
showTotal | ( | No | showTotal configures DmPagination. |
total | number, | Yes | total configures DmPagination. |
range | [number, number], | Yes | range configures DmPagination. |
selectedTotal | number, | Yes | selectedTotal configures DmPagination. |
showTotalSimple | ( | No | showTotalSimple configures DmPagination. |
total | number, | Yes | total configures DmPagination. |
range | [number, number], | Yes | range configures DmPagination. |
selectedTotal | number, | Yes | selectedTotal configures DmPagination. |
selected | (selectedTotal: number) => string | No | selected configures DmPagination. |