Pagination
Links or buttons for moving between pages of results.
Example
<focsd-pagination total="12" page="5"></focsd-pagination>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/components/focsd-pagination.js';</script>
<focsd-pagination total="12" page="5"></focsd-pagination>import { Pagination } from '@focsd-dev/react';
export function Example() { return <Pagination total="12" page="5"></Pagination>;}<script setup>import '@focsd-dev/components/focsd-pagination.js';</script>
<template> <focsd-pagination total="12" page="5"></focsd-pagination></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-pagination.js';
// template<focsd-pagination total="12" page="5"></focsd-pagination><script> import '@focsd-dev/components/focsd-pagination.js';</script>
<focsd-pagination total="12" page="5"></focsd-pagination>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
page | page | number | 1 |
total | total | number | 1 |
label | label | string | — |
siblings | siblings | number | 1 |
href | href | string | — |
CSS parts
Style the inside of the component with ::part(), for example focsd-pagination::part(disabled).
| Part | Description |
|---|---|
disabled | Added to the previous or next control on the first or last page (with `href`). |
gap | The ellipsis between page numbers. |
list | The list element. |
nav | The nav element. |
page | Each page button or link (with `current` page via aria-current). |
previous | The previous-page control. |
next | The next-page control. |
Accessibility
- A
<nav aria-label="Pagination">landmark. Page buttons are named "Page 5"; the current one hasaria-current="page". - Previous/next are named "Previous page"/"Next page" and disabled at the ends. Ellipses are hidden.
- With
href="/results?page={page}"it renders real links; otherwise buttons that firefocsd-page-changewithdetail.page.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.