Skip to main content
Vuetify0 is now in beta!
Vuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One
Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

createPagination

A lightweight composable for managing pagination state with navigation methods and computed visible page items.

Usage

The createPagination composable provides reactive pagination state management with navigation methods and automatic computation of visible page items with ellipsis support.

ts
import { ref } from 'vue'
import { createPagination } from '@vuetify/v0'

const pagination = createPagination({
  size: 200, // Total items
  itemsPerPage: 10,
  visible: 5,
})

console.log(pagination.pages) // 20 (200 items / 10 per page)
console.log(pagination.items.value)
// [
//   { type: 'page', value: 1 },
//   { type: 'page', value: 2 },
//   { type: 'page', value: 3 },
//   { type: 'ellipsis', value: '…' },
//   { type: 'page', value: 20 }
// ]

Context / DI

Use createPaginationContext to share a pagination instance across a component tree:

ts
import { createPaginationContext } from '@vuetify/v0'

export const [usePagination, providePagination, pagination] =
  createPaginationContext({ size: 100, itemsPerPage: 10 })

// In parent component
providePagination()

// In child component
const pagination = usePagination()
pagination.next()

Architecture

createPagination computes page state and navigation:

Pagination Flow

Use controls to zoom and pan. Click outside or press Escape to close.

Pagination Flow

Reactivity

Property/MethodReactiveNotes
pageWritableComputedRef, auto-clamps when total pages shrinks
pagesTotal page count, computed from size / itemsPerPage
itemsComputed array of PaginationTicket — each is { type: 'page', value: number } or { type: 'ellipsis', value: string }
pageStartComputed, start index for current page
pageStopComputed, end index for current page
isFirstComputed, true when on first page
isLastComputed, true when on last page
itemsPerPageGetter — current items per page (reflects option)
sizeGetter — total item count (reflects option)
ellipsisGetter — the ellipsis string or false when disabled
select(page)-Navigate to a specific page number
next()-Go to next page (no-op if already last)
prev()-Go to previous page (no-op if already first)
first()-Jump to page 1
last()-Jump to final page
Tip

v-model support Pass a ref as the page option to enable two-way binding with your component’s page state.

Examples

Paginated List

Category-filtered list with page navigation controls, demonstrating select(), next(), prev(), and reactive pageStart/pageStop slicing.

1Item 1
Design
2Item 2
Engineering
3Item 3
Marketing
4Item 4
Sales
5Item 5
Design
6Item 6
Engineering
...

Showing 1–6 of 47 · Page 1 of 8

API Reference

The following API details are for the createPagination composable.
Was this page helpful?

Ctrl+/