Pagination
Page navigation with a page-size selector, a derived range label, and first / prev / next / last controls. A Lit web component — page state and prev/next are real runtime behavior.
Preview
<esa-pagination total-items="237"></esa-pagination>
<script>
const p = document.querySelector('esa-pagination');
p.pageSizeOptions = [10, 25, 50, 100];
p.addEventListener('pagechange', (e) => console.log(e.detail));
</script> import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@esa/ecology/esa-pagination';
@Component({
selector: 'app-pagination-demo',
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<esa-pagination
total-items="237"
[pageSizeOptions]="pageSizeOptions"
(pagechange)="onPagechange($event)"
></esa-pagination>
`,
})
export class PaginationDemo {
pageSizeOptions = [10, 25, 50, 100];
onPagechange(event: Event) {
const e = event as CustomEvent;
console.log(e.detail);
}
} Variants
Compact form — hide the page-size selector and the first/last jump buttons for tighter footers.
<esa-pagination
total-items="80"
page-size="20"
show-page-size-selector="false"
show-first-last-buttons="false"
></esa-pagination> import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@esa/ecology/esa-pagination';
@Component({
selector: 'app-pagination-demo',
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<esa-pagination
total-items="80"
page-size="20"
show-page-size-selector="false"
show-first-last-buttons="false"
></esa-pagination>
`,
})
export class PaginationDemo {} States
Disabled — all controls are dimmed and inert.
<esa-pagination total-items="100" disabled></esa-pagination> import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@esa/ecology/esa-pagination';
@Component({
selector: 'app-pagination-demo',
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<esa-pagination total-items="100" disabled></esa-pagination>
`,
})
export class PaginationDemo {} API
| Prop | Type | Default | Description |
|---|---|---|---|
total-items | number | 0 | Total number of items across all pages; drives the range label and page count. Property: `totalItems`. |
page-size | number | 25 | Items per page. Changing it resets to page 0. Property: `pageSize`. |
current-page | number | 0 | Active page, zero-based. Property: `currentPage`. |
page-size-options | number[] | [10, 25, 50, 100] | Choices in the page-size selector. Array property — set in JS. Property: `pageSizeOptions`. |
show-page-size-selector | boolean | true | Toggles the "Items per page" selector. Property: `showPageSizeSelector`. On by default. Write `="false"` to turn it off — unusually for a boolean attribute, this one reads the value. |
show-first-last-buttons | boolean | true | Toggles the first / last jump buttons. Property: `showFirstLastButtons`. On by default. Write `="false"` to turn it off — unusually for a boolean attribute, this one reads the value. |
disabled | boolean | false | Dims and disables all controls. Reflected as an attribute. |
Events
| Event | Type | Default | Description |
|---|---|---|---|
pagechange | CustomEvent | — | Fired when the page changes. detail: { page: number } (zero-based). Bubbles and composed. |
pagesizechange | CustomEvent | — | Fired when the page size changes; page also resets to 0. detail: { pageSize: number }. Bubbles and composed. |
Binding these events from Angular
Every one of these is a CustomEvent, so the payload is on
$event.detail — $event.target.value reads empty, with no
error. The names are lowercase and Angular passes them to
addEventListener verbatim, so camel-casing one means it never fires.
(pagechange)="onPagechange($event.detail)"(pagesizechange)="onPagesizechange($event.detail)"
page-size-options is an array property — set it in JS, not as an attribute. The range label is derived as "start – end of total" ("0 of 0" when empty).
Accessibility
- Wraps controls in
role="navigation"witharia-label="Pagination". - Each control button has a descriptive
aria-label(First / Previous / Next / Last page). - The page-size selector is a native labeled
<select>. - Boundary buttons disable at the first/last page rather than wrapping.
Theming surface
Every public token this component reads, extracted from its source at build time,
split by blast radius: the hooks that belong to this component,
then the shared and system tokens it consumes alongside everything else. The
Resolves to column walks each token's real lineage —
component → semantic → primitive → raw value — so you
can see exactly where re-pointing it lands. A spoke re-skins by overriding these in
its theme-<slug>.css; component internals are never edited. No
hook for what you need? File it with /request-lego.
Type roles it names
This component does not set a size, weight, face or tracking of its own — it names a composite, and the composite carries all five. A composite is a class rather than a token, so none of it appears in the tables below; re-theme text by re-pointing the token family, not by editing the component.
| Role | Re-point | Reach |
|---|---|---|
.typography-microcopy-md-subtle |
| +7 more componentsesa-combobox, esa-date-picker, esa-filter-dropdown, esa-input-tag, esa-search-panel, esa-select, esa-text-field |
Wired to this component
None. This component has no hooks of its own — it themes entirely through the shared tokens below, so every override here also moves its siblings.
Shared tokens it reads
Owned by a family or by the semantic layer. Still overridable — but scope the
override (esa-foo { --form-border-color: … }) unless you mean to move
everything that reads it. Reach says what else that is.
| Token | Reach | Resolves to |
|---|---|---|
--focus-ring-color | component focus ring group · +34 more | #3e9b4f via --color-border-default-focus → --color-grass-10 |
--focus-ring-offset | component focus ring group · +31 more | 2px |
--focus-ring-width | component focus ring group · +35 more | 2px via --border-width-focus → --border-width-200 |
--border-width-default | semantic every component | 1px via --border-width-100 |
--color-background-elevation-raised | semantic every component | #fcfcfc via --color-gray-1 |
--color-background-overlay-hover | semantic every component | rgba(0, 0, 0, 0.03) |
--color-border-default | semantic every component | one role per property, so a theme can move the ring's weight and its colour independently. Tier 3's --focus-ring-width now reads this instead of holding a bare 2px, which is the same shape --focus-ring-color has always had (a thin tier-3 alias over a tier-2 role) — width was simply never given the tier-2 half.
*
* This role was rejected once, and the rejection is worth recording because its PREMISE was wrong rather than its reasoning. The argument against an `emphasis` width was that every 2px border in the kit is micro-geometry — spinner rings, the kbd keycap lip, a chevron. The focus ring was not in that enumeration and does not fit it: 33 components render it, more than read any other tier-3 token, and it is not micro-geometry but an accessibility affordance whose weight is a legitimate brand axis (a spoke that needs a heavier ring for contrast has to be able to reach it). It is also not a `border` in any component — every consumer paints it with `outline` or `box-shadow` — which is precisely why a survey of BORDERS missed it. The name still says `border` because tier 2 already calls the ring's colour --color-border-default-focus |
--color-content-default | semantic every component | #202020 via --color-gray-12 |
--color-content-default-secondary | semantic every component | #646464 via --color-gray-11 |
--color-content-disabled | semantic every component | #8d8d8d via --color-gray-9 |
--radius-pill | semantic every component | 9999px via --radius-full |
--radius-sm | semantic every component | 0.25rem via --radius-100 |
--transition-fast | semantic every component | 150ms via --duration-150 |
--typography-label-md-font-size | semantic every component | clamp(0.75rem, 0.66rem + 0.44vw, 0.9375rem) via --font-size-200 |
--spacing-100 | primitive every component | 0.25rem |
--spacing-200 | primitive every component | 0.5rem |
--spacing-400 | primitive every component | 1rem |