Pagination
Stable cursor/page scope; loaded rows are not misrepresented as global selection.
Use the web element directly without the semantic runtime.
A registered presentation adapter can bind this component to host-owned meaning and state.
The standard recipe resolver does not select this component automatically.
Import and live example#
Page two of four with previous and next controls enabled.
Interactive preview requires JavaScript.
View the complete example source
import {registerAeliqoElements} from "@varendo/web";
import {
AeliqoBreadcrumbElement,
AeliqoMenuElement,
AeliqoPaginationElement,
AeliqoTabsElement,
AeliqoTreeNavElement,
type AeliqoBreadcrumbItem,
type AeliqoMenuItem,
type AeliqoTabItem,
type AeliqoTreeNavNode,
} from "@varendo/web/navigation";
const tabs: readonly AeliqoTabItem[] = [
{id: "overview", label: "Overview", content: "Overview content"},
{id: "details", label: "Details", content: "Details content"},
{id: "history", label: "History", content: "History content", disabled: true},
];
const breadcrumb: readonly AeliqoBreadcrumbItem[] = [
{id: "home", label: "Home", href: "/"},
{id: "reports", label: "Reports", href: "/reports"},
{id: "current", label: "Weekly report", current: true},
];
const menuItems: readonly AeliqoMenuItem[] = [
{id: "open", label: "Open report"},
{id: "archive", label: "Archive"},
{id: "disabled", label: "Unavailable", disabled: true},
];
const treeNodes: readonly AeliqoTreeNavNode[] = [
{id: "reports", label: "Reports", children: [{id: "weekly", label: "Weekly"}, {id: "monthly", label: "Monthly"}]},
{id: "settings", label: "Settings", disabled: true},
];
registerAeliqoElements();
const host = document.querySelector<HTMLElement>("#aeliqo-example") ?? (() => {
const created = document.createElement("div");
created.id = "aeliqo-example";
(document.body ?? document.documentElement).append(created);
return created;
})();
function createCatalogRoot(container: HTMLElement): HTMLElement {
const root = document.createElement("div");
root.dataset.catalogSourceRoot = "true";
root.style.display = "grid";
root.style.gap = "12px";
container.append(root);
return root;
}
function createCatalogElement<T extends HTMLElement>(tagName: string, container: HTMLElement): T {
const element = document.createElement(tagName) as T;
element.setAttribute("data-aeliqo-theme", "light");
container.append(element);
return element;
}
function appendSlottedText(root: HTMLElement, slot: string, textContent: string): void {
const content = document.createElement("span");
content.slot = slot;
content.textContent = textContent;
root.append(content);
}
const root = createCatalogRoot(host);
(((root) => {
const element = createCatalogElement<AeliqoPaginationElement>("aeliqo-pagination", root);
element.page = 2;
element.pageCount = 4;
element.hasPrevious = true;
element.hasNext = true;
element.label = "Report pages";
}))(root);
Purpose#
Shows the current page with previous and next controls from host-supplied data. Activation requests a page change; the component never fetches rows itself.
When to use it#
- Lists or tables split into discrete pages.
- Moving forward and back through paged results.
- Keeping loaded rows scoped to the requested page.
When to use a different component#
- Use Table when the task is comparing records in columns.
- Use SearchResults for a full query-results view with count and details.
Properties and defaults#
The host owns page data and applies the requested page after validating it.
| Property | Use and ownership | Declared type | Initial value |
|---|---|---|---|
page | Controls the current one-based page. | number | 1 |
pageCount | Provides the total known page count used to label and bound navigation. | number | undefined |
hasPrevious | Declares whether previous is available. The host updates it with the underlying data state. | boolean | false |
hasNext | Declares whether next is available. The host updates it with the underlying data state. | boolean | false |
label | Provides the visible label and accessible name for the component. | string | 'Pagination' |
pending | Marks an action as in progress and prevents repeated activation until the host clears it. | boolean | false |
Events#
| Event | Payload | Emitted | Application responsibility |
|---|---|---|---|
aeliqo-page-change | The requested one-based page. | After previous, next, or a page control is activated. | Load the authorized page and update controlled page and content. |
Events cross the component boundary as user proposals. Validate their detail and current authority before applying a business effect.
Listen for aeliqo-page-change
const element = document.querySelector('aeliqo-pagination');<p>element?.addEventListener('aeliqo-page-change', (event) => {
const proposal = (event as CustomEvent<unknown>).detail;
// Validate the proposal, update host state, then assign controlled properties.
applyProposal(proposal);
});States and failure handling#
Relevant states:
- ready
- disabled
Expected result: The current page and available directions are announced and page changes are emitted as requests.
Keyboard, focus, and accessibility#
Keyboard behavior:
- Tab
- Enter
- Space
Exposed semantics:
- aria-label
- aria-live
- button
- nav
Responsive behavior#
Keep page controls large enough to operate. Let the host trim visible page links on narrow screens without hiding the current page.
Style hooks#
- Shadow parts:
next,previous,status - Varendo design tokens referenced:
--aeliqo-color-border,--aeliqo-color-muted,--aeliqo-color-surface,--aeliqo-control-min-target,--aeliqo-radius-small,--aeliqo-space-4,--aeliqo-space-8
Related components#
Generated TypeScript declaration#
View generated declaration
export declare class AeliqoPaginationElement extends AeliqoFoundationElement {
static readonly properties: {
page: {
type: NumberConstructor;
};
pageCount: {
type: NumberConstructor;
attribute: string;
};
hasPrevious: {
type: BooleanConstructor;
attribute: string;
};
hasNext: {
type: BooleanConstructor;
attribute: string;
};
label: {
type: StringConstructor;
};
pending: {
type: BooleanConstructor;
reflect: boolean;
};
};
static readonly styles: import("lit").CSSResult[];
page: number;
pageCount?: number;
hasPrevious: boolean;
hasNext: boolean;
label: string;
pending: boolean;
private normalizedPage;
private normalizedPageCount;
private move;
protected render(): import("lit").TemplateResult<1>;
}Version#
This page documents the Varendo 0.6 component contract.
