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 Examples

Basic

v-model page, total pages, visible window, and optional first/last controls.

RTL & active color

Right-to-left swaps control direction; active-color sets ink on the filled page button.

Disabled

Single-page or loading states can disable the whole nav; set aria-label when context matters.

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

Each scenario under Live Examples includes a copyable Vue snippet (source is imported from the same SFC as the preview).

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.