Composite
Pager
A labelled previous / next navigation with the page title on each link.
Previous and next
prevButton and nextButton are Buttons; each renders when set. Its subtitle is the page title, shown under a small “Previous” or “Next”.
---
import PagerBlock from '@alfadormx/blocks/composite/Pager.astro';
const prev = { href: '/documentation/composite/NavigationTreeHorizontal' };
const next = { href: '/documentation/composite/PostCard' };
---
<PagerBlock
prevButton={{ ...prev, subtitle: 'NavigationTreeHorizontal' }}
nextButton={{ ...next, subtitle: 'PostCard' }}
/>Next only
A lone next link sits at the inline end: right in left-to-right text, left in right-to-left.
---
import PagerBlock from '@alfadormx/blocks/composite/Pager.astro';
const next = { href: '/documentation/composite/PostCard' };
---
<PagerBlock nextButton={{ ...next, subtitle: 'PostCard' }} />Previous only
A lone previous link sits at the inline start.
---
import PagerBlock from '@alfadormx/blocks/composite/Pager.astro';
const prev = { href: '/documentation/composite/NavigationTreeHorizontal' };
---
<PagerBlock prevButton={{ ...prev, subtitle: 'NavigationTreeHorizontal' }} />Long titles
The row wraps, and a long title wraps inside its link.
---
import PagerBlock from '@alfadormx/blocks/composite/Pager.astro';
const prev = { href: '/documentation/composite/NavigationTreeHorizontal' };
const next = { href: '/documentation/composite/PostCard' };
---
<PagerBlock
prevButton={{
...prev,
subtitle: 'A horizontal navigation bar with dropdown groups for the main site sections',
}}
nextButton={{
...next,
subtitle: 'A blog post card with its cover, date, reading time, excerpt and every tag',
}}
/>Custom labels
ariaLabel names the landmark; each link’s label replaces the built-in text. defaultButtonConfig is merged under both links.
---
import PagerBlock from '@alfadormx/blocks/composite/Pager.astro';
const prev = { href: '/documentation/composite/NavigationTreeHorizontal' };
const next = { href: '/documentation/composite/PostCard' };
---
<PagerBlock
ariaLabel="Documentation pages"
prevButton={{ ...prev, label: 'Back', subtitle: 'NavigationTreeHorizontal' }}
nextButton={{ ...next, label: 'Continue', subtitle: 'PostCard' }}
defaultButtonConfig={{ intent: 'primary' }}
/>Slot
The default slot renders between the links. Here the row is centred, and class: 'ms-0' on nextButton cancels its inline-end default.
---
import PagerBlock from '@alfadormx/blocks/composite/Pager.astro';
const prev = { href: '/documentation/composite/NavigationTreeHorizontal' };
const next = { href: '/documentation/composite/PostCard' };
---
<PagerBlock class="justify-center" prevButton={{ ...prev }} nextButton={{ ...next, class: 'ms-0' }}>
<p class="m-0 text-sm text-emphasis">Page 2 of 3</p>
</PagerBlock>API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| prevButton | ButtonProps | — | Previous link; renders when set (default: outline, left arrow, per-language "Previous"). `subtitle` is the page title, shown as the second line. |
| nextButton | ButtonProps | — | Next link; renders when set and sits at the inline end (default: outline, right arrow, per-language "Next"). |
| defaultButtonConfig | LayerConfig<ButtonProps> | — | Layer merged under both links, under each link's own values. |
| ariaLabel | string | — | Accessible name of the navigation landmark (default: per-language "Pagination"). |
| langCode | string | — | Language of the built-in labels (default: the site's default language). |
| gap | 'none' | 'tight' | 'normal' | 'loose' | 'normal' | Space between the links and the slot (default: 'normal'). |
| class | string | — | Classes on the `<nav>` (`data-pager`). |
| id | string | — | `id` on the `<nav>`. |