Pagination
Navigate multi-page result sets. Use for tables, lists, and search results — not for scrolling within a single view.
Overview
The catnip-pagination custom element offers two layouts from Figma:
| Layout | Role |
|---|---|
default | Item range summary (21-30 of 86 items) plus Previous / page numbers / Next |
compact | First / Previous / current page / of N / Next / Last |
| Prop | Role |
|---|---|
modelValue | Current page (1-based) |
totalPages | Total pages (optional — derived from totalItems / pageSize when omitted) |
totalItems / pageSize | Drive the default-layout range summary |
siblingCount | Pages shown beside the current page in default layout |
Controls compose catnip-button (purpose="utility", appearance="ghost"). Selected page uses the button selected state.
Live example
Guidelines
When to use
- Paginate tables, lists, or search results with a known page count or item total.
- Prefer
defaultwhen there is room for a page list and an item-range summary. - Prefer
compactin narrow toolbars or dense panels (first / previous / current / of N / next / last).
When not to use
- Do not use Pagination for infinite scroll or “load more” — those are different patterns.
- Do not use Pagination to step a single numeric field — use Number Input.
Composition
Bind the current page with .modelValue and @update:modelValue (do not use v-model on the host):
<catnip-pagination
layout="default"
.modelValue="page"
.totalItems="86"
.pageSize="10"
@update:modelValue="page = $event.detail[0] ?? $event.detail"
/>Compact:
<catnip-pagination layout="compact" .modelValue="page" .totalPages="9" @update:modelValue="page = $event.detail[0] ?? $event.detail" />Single page and empty results
Show Pagination only when there is more than one page. When every item fits on one page, or there are no results, leave the component out instead of showing a Previous / 1 / Next row with nothing to navigate. The component does not hide itself, so render it conditionally:
<catnip-pagination
v-if="totalItems > pageSize"
layout="default"
.modelValue="page"
.totalItems="totalItems"
.pageSize="pageSize"
@update:modelValue="page = $event.detail[0] ?? $event.detail"
/>- The default layout's range summary goes away with the component. If users need the item count, show it elsewhere, for example next to the table heading.
- When filtering reduces the results to one page, also reset the current page to 1 so the visible rows are not taken from a page that no longer exists.
Layouts
| Layout | Controls |
|---|---|
| default | Range summary · Previous · page numbers (with ellipsis) · Next |
| compact | First · Previous · current page · of N · Next · Last |
Labels
Override previousLabel, nextLabel, ofLabel, itemsLabel, and aria-label props for localization. Page button labels use pageAriaLabel with a {page} placeholder.