Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 Logo
Theme
Mode
Accessibility
Vuetify

createPagination

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


IntermediateJan 30, 2026

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 }
// ]

Architecture

createPagination computes page state and navigation:

Pagination Flow

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

Pagination Flow

API Pattern

FunctionPurpose
createPagination(options)Factory - returns a pagination context
createPaginationContext(options)Factory with DI - returns [usePagination, providePagination, pagination] trinity
usePagination(namespace?)Injection getter - retrieves provided pagination context

Basic Usage

ts
const pagination = createPagination({
  size: 100,
  itemsPerPage: 10,
})

pagination.next() // Go to next page
pagination.goto(5) // Go to page 5

With Dependency Injection

ts
// Create context with DI support
const [usePagination, providePagination, pagination] = createPaginationContext({
  namespace: 'app:pagination',
  itemsPerPage: 20,
})

// In parent component
providePagination()

// In child component
const pagination = usePagination()

API Reference

The following API details are for the createPagination composable.

Functions

createPagination

(_options?: PaginationOptions) => PaginationContext

Creates a pagination instance.

createPaginationContext

(_options?: PaginationContextOptions) => ContextTrinity<PaginationContext>

Creates a pagination context for dependency injection.

usePagination

(namespace?: string) => PaginationContext

Returns the current pagination instance from context.

Options

page

number | ShallowRef<number>

Initial page or ref for v-model (1-indexed).

Default: 1

itemsPerPage

MaybeRefOrGetter<number>

Items per page.

Default: 10

size

MaybeRefOrGetter<number>

Total number of items.

Default: 0

visible

MaybeRefOrGetter<number>

Maximum visible page buttons.

Default: 5

ellipsis

string | false

Ellipsis character.

Default: '…'

Properties

page

ShallowRef<number>

Current page (1-indexed)

itemsPerPage

number

Items per page

size

number

Total number of items

pages

number

Total number of pages (computed from size / itemsPerPage)

ellipsis

string | false

Ellipsis character, or false if disabled

items

ComputedRef<PaginationTicket[]>

Visible page numbers and ellipsis for rendering

pageStart

ComputedRef<number>

Start index of items on current page (0-indexed)

pageStop

ComputedRef<number>

End index of items on current page (exclusive, 0-indexed)

isFirst

ComputedRef<boolean>

Whether current page is the first page

isLast

ComputedRef<boolean>

Whether current page is the last page

Methods

first

() => void

Go to first page

last

() => void

Go to last page

next

() => void

Go to next page

prev

() => void

Go to previous page

select

(value: number) => void

Go to specific page

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/