Skip to content

GkPagination

A pagination control (role="navigation") with previous / next, optional first / last, numbered page buttons with ellipsis when length exceeds totalVisible, v-model on the current page, keyboard Left/Right (swapped when dir="rtl"), and ResizeObserver to estimate how many page buttons fit when totalVisible is omitted.

This is smaller than Vuetify VPagination: no theme / locale composables, no VDefaultsProvider, and GkButton is used for controls instead of a dedicated VPaginationBtn.

When to use

Use for page-based navigation where users need clear movement between finite result sets. Prefer this over infinite scroll in admin/reporting views requiring random access to pages.

Live demo

Page 3 of 24

API

Props

PropTypeDefaultDescription
modelValuenumber1Current page; v-model
startnumber | string1First page number
lengthnumber | string1Total number of pages
disabledbooleanfalseDisables all controls
totalVisiblenumber | stringMax page number buttons; if omitted, uses container ResizeObserver or window width fallback
showFirstLastPagebooleanfalseShows first / last controls
ellipsisstring'...'Ellipsis segment in the range
dir'ltr' | 'rtl''ltr'Swaps control icons and keyboard direction
activeColorstringSets --gk-pagination-active-color (text ink on the filled primary active page button)
variantGkButton variant'ghost'Variant for non-active page buttons
size'sm' | 'md''sm'GkButton size
firstIcon / prevIcon / nextIcon / lastIconstring« / / / »Default control labels
ariaLabelstring'Pagination'Root aria-label
pageAriaLabelstring'Page'Page button label prefix
currentPageAriaLabelstring'Current page'Active page prefix
firstAriaLabel / previousAriaLabel / nextAriaLabel / lastAriaLabelstringEnglish defaultsControl aria-label

Additional attributes are forwarded to the root <nav>.

Events

EventPayload
update:modelValuenumber
firstnumber
prevnumber
nextnumber
lastnumber

Slots

SlotSlot propsDescription
itemisActive, key, page, propsCustom page button
first / prev / next / lasticon, onClick, disabled, aria-label, aria-disabledCustom controls

Utilities

createRange, getMax, buildPaginationRange are exported from god-kit/vue and god-kit/vue/navigation for custom UIs.

Tokens

TokenPurpose
--gk-pagination-gapFlex gap between controls
--gk-pagination-active-colorActive page text color on the primary fill (default on-primary; override with activeColor)

Examples

Basic

vue
<script setup lang="ts">
import { ref } from 'vue'
import { GkPagination } from 'god-kit/vue'

const page = ref(1)
</script>

<template>
  <GkPagination v-model="page" :length="12" :total-visible="7" show-first-last-page />
</template>

Advanced

vue
<GkPagination
  v-model="page"
  :length="42"
  :total-visible="9"
  show-first-last-page
  dir="rtl"
  active-color="var(--gk-color-primary)"
/>

Edge case

vue
<GkPagination
  v-model="page"
  :length="1"
  disabled
  aria-label="Results pagination (disabled)"
/>

Accessibility notes

  • Set ariaLabel to a page-specific label when multiple pagination regions exist.
  • Keyboard shortcuts support Left/Right (RTL-aware) and Home/End.
  • Keep control labels localized through firstAriaLabel, previousAriaLabel, nextAriaLabel, and lastAriaLabel.

Out of scope

Vuetify useLocale, useTheme, useDisplay parity, n() number formatting, and IconValue icon registry.

Released under the MIT License.