Skip to content
Focsd homeFocsd homeFocsd
Forms

Pagination

Links or buttons for moving between pages of results.

  • Tag: focsd-pagination
  • Pattern: Navigation landmark
  • Category: Navigation

Example

HTML
<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>

API

Attributes

AttributePropertyTypeDefault
pagepagenumber1
totaltotalnumber1
labellabelstring—
siblingssiblingsnumber1
hrefhrefstring—

CSS parts

Style the inside of the component with ::part(), for example focsd-pagination::part(disabled).

PartDescription
disabledAdded to the previous or next control on the first or last page (with `href`).
gapThe ellipsis between page numbers.
listThe list element.
navThe nav element.
pageEach page button or link (with `current` page via aria-current).
previousThe previous-page control.
nextThe next-page control.

Accessibility

  • A <nav aria-label="Pagination"> landmark. Page buttons are named "Page 5"; the current one has aria-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 fire focsd-page-change with detail.page.