Pagination
Navigate between discrete result pages with a compact control strip.
Live preview
HTML
<nav class="xsh-pagination" aria-label="Results pages">
<button class="xsh-page" data-xsh-page="1" aria-current="page" aria-label="Page 1">1</button>
<button class="xsh-page" data-xsh-page="2" aria-label="Page 2">2</button>
<button class="xsh-page" data-xsh-page="3" aria-label="Page 3">3</button>
<button class="xsh-page" data-xsh-page="4" aria-label="Page 4">4</button>
</nav>Installation & markup
Include the local stylesheet and script once on the page, then place the component inside a data-xsh-ui root. The example above works without a build system.
<link rel="stylesheet" href="/dist/xshna-ui.css">
<div data-xsh-ui>
<!-- Add the HTML example above -->
</div>
<script defer src="/dist/xshna-ui.js"></script>Component API
Public classes, attributes and hooks used by this example. Keep the xsh- prefix intact.
| Identifier | Contract |
|---|---|
xsh-pagination | Used by the example markup and component styles or behavior. |
xsh-page | Used by the example markup and component styles or behavior. |
data-xsh-page | Used by the example markup and component styles or behavior. |
xsh:page-change | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Native buttons are keyboard accessible; aria-current=page identifies the selected result page.
Implementation note. The component updates selection only; listen to xsh:page-change to fetch or display the corresponding records.
Interaction contract
Behavioral components use the shared delegated runtime; visual-only primitives rely on semantic HTML and CSS. Runtime controls emit bubbling xsh:* CustomEvents; bind application handlers to those events when server persistence, API data or navigation is required.