Components

Pagination

Accessible page navigation with ranges, ellipses, boundary controls, and optional links.

Pagination calculates a compact page range from total items and page size, then renders semantic navigation with current-page metadata, optional ellipses, and boundary controls. Controls can be buttons or real links.

Application code handles data fetching and URL state through v-model and getPageHref.

Anatomy

  • #first: First-page control content.
  • #previous: Previous-page control content.
  • #page: Page control content with page number and active state.
  • #ellipsis: Omitted-range marker with start/end side.
  • #next: Next-page control content.
  • #last: Last-page control content.
  • #state: Optional renderless output with page, page count, visible items, and navigation action.

The component generates nav, list, page controls, current-page ARIA, and disabled boundary behavior. Style generated parts with ui.

Usage

Page 7 of 24

Examples

Visible siblings

siblingCount controls how many pages remain visible on each side of the current page. Without edges, Pagination renders a moving compact window.

<template>
  <Pagination v-model="page" :total="200" :items-per-page="10" :sibling-count="1" />
</template>

Edges and ellipses

Set showEdges to preserve first and last page numbers and insert ellipses around omitted ranges.

<template>
  <Pagination v-model="page" :total="500" show-edges />
</template>

First and last controls

Boundary controls are opt-in. Previous and next controls are enabled by default and can also be removed.

<template>
  <Pagination
    v-model="page"
    :total="500"
    show-first-last
    :show-previous-next="false"
  />
</template>

Return an href to render controls as anchors. Disabled boundary links prevent navigation and leave the tab order.

<template>
  <Pagination
    v-model="page"
    :total="500"
    :get-page-href="(value) => `/reports?page=${value}`"
  />
</template>

Cancel navigation

value-change fires before the model update, so pending forms or unsaved state can block a page change.

<template>
  <Pagination
    v-model="page"
    :total="500"
    @value-change="(_page, details) => {
      if (hasUnsavedChanges) details.cancel()
    }"
  />
</template>

API Reference

Model

ModelTypeDefaultDescription
v-modelnumber1Current page. Rendered state is clamped to available pages.

Props

PropTypeDefaultDescription
totalnumber0Total number of data items.
itemsPerPagenumber10Data items represented by each page.
siblingCountnumber2Visible page numbers on each side of current page.
showEdgesbooleanfalseAlways includes first/last page numbers and ellipses.
showFirstLastbooleanfalseRenders explicit first/last controls.
showPreviousNextbooleantrueRenders previous/next controls.
disabledbooleanfalseDisables all pagination controls.
ariaLabelstring"Pagination"Accessible navigation label.
getPageHref(page) => string | undefinedRenders controls as anchors when an href is returned.
uiPaginationUiClasses for structural parts.

Emits

EventPayloadDescription
update:modelValuepageFired after an accepted page change.
value-change(page, details)Fired before page change. details.cancel() prevents it.

Slots

SlotPropsDescription
firstdisabledFirst-page control content.
previousdisabledPrevious-page control content.
pagepage, isActiveNumbered page content.
ellipsissideStart/end ellipsis content.
nextdisabledNext-page control content.
lastdisabledLast-page control content.
statepage, pageCount, items, goToPageOptional state-driven custom UI.

Methods

MethodDescription
goToPage(page, reason?, event?)Clamps and activates a page.
firstPage(event?)Activates page one.
previousPage(event?)Activates previous page.
nextPage(event?)Activates next page.
lastPage(event?)Activates final page.
pageCountRead-only computed page count.

UI Options

KeyDescription
rootSemantic navigation root.
listPage list.
itemEvery list item wrapper.
firstFirst-page control.
previousPrevious-page control.
pageNumbered page control.
ellipsisOmitted-range marker.
nextNext-page control.
lastLast-page control.

Styling Hooks

UI keyCSS classData attrs
rootakaza-pagination`data-akaza-state="single
listakaza-pagination-list
itemakaza-pagination-item`data-akaza-type="page
firstakaza-pagination-firstdata-akaza-disabled, native/ARIA disabled attrs
previousakaza-pagination-previousdata-akaza-disabled, native/ARIA disabled attrs
pageakaza-pagination-page`data-akaza-state="active
ellipsisakaza-pagination-ellipsisdata-akaza-state="ellipsis", `data-akaza-side="start
nextakaza-pagination-nextdata-akaza-disabled, native/ARIA disabled attrs
lastakaza-pagination-lastdata-akaza-disabled, native/ARIA disabled attrs

Plain class applies to the nav root. Use ui.page and control-specific keys for generated controls.

Keyboard

Pagination uses native buttons or links. Tab moves through enabled controls; Enter and Space activate buttons, and Enter activates links. Boundary controls are disabled and removed from the tab order when they cannot move further.