Pagination
Page-by-page navigation for lists, tables, and search results. The VdPagination component renders a numbered control bound via v-model and :total, automatically collapsing long ranges with ellipses and emitting @update:modelValue and a pagination:change event as the user navigates.
Basic
Current page: 1
Sizes
Alignment
Large Sets with Ellipsis
With more than :max-visible pages, the control always shows the first and last page plus a window around the current page, separated by “…”.
Current page: 10
Disabled
Add disabled to make the whole control non-interactive while data is loading.
API Reference
Usage
<script setup lang="ts">
import { VdPagination } from "@vanduo-oss/vd3";
const page = ref(1);
</script>
<template>
<VdPagination v-model="page" :total="20" :max-visible="7" />
</template>VdPagination Props & Events
| Prop / Event | Type | Default | Description |
|---|---|---|---|
v-model (modelValue) | number | 1 | Two-way bound active page (1-indexed). |
:total | number | — | Total number of pages to render. |
:maxVisible | number | 7 | Maximum page buttons shown before collapsing distant ranges to ellipses. |
:size | "sm" | "md" | "lg" | "md" | Size modifier applied to the pagination list. |
:align | "left" | "center" | "right" | "left" | Horizontal alignment modifier on the pagination list. |
:disabled | boolean | false | Disables all page and previous/next buttons. |
@update:modelValue | (page: number) => void | — | Emitted when the user selects a new page. |
pagination:change | CustomEvent<{ page: number, totalPages: number }> | — | Native DOM event bubbling from the pagination root when the page changes. |
CSS Classes
| Class | Description |
|---|---|
.vd-pagination | Flex list container for the pagination items |
.vd-pagination-item | An individual page slot (wraps a link or ellipsis) |
.vd-pagination-link | The clickable anchor inside a page item |
.vd-pagination-item.active | The current page (filled primary colour) |
.vd-pagination-item.disabled | A non-interactive item (e.g. Previous on page 1) |
.vd-pagination-prev / .vd-pagination-next | The previous / next navigation items |
.vd-pagination-ellipsis | The “…” gap shown between distant page ranges |
.vd-pagination-sm / .vd-pagination-lg | Size modifiers on the container |
.vd-pagination-center / .vd-pagination-right | Alignment modifiers on the container |
Programmatic Control
Accessibility
- The control is wrapped in
<nav aria-label="Pagination"> - The active page link carries
aria-current="page" - Each page link has a descriptive
aria-label(e.g."Page 4") - Ellipses use
aria-hidden="true"so they are skipped by screen readers - Previous / Next become
.disabled(and non-interactive) at the range boundaries