VPagination
TheVPagination component provides pagination controls for navigating through large datasets. It features responsive design, keyboard navigation, and extensive customization options.
Basic Usage
Props
Current active page number. Use with v-model.
Total number of pages.
Starting page number (allows 0-based or 1-based indexing).
Maximum number of page buttons to display. Auto-calculated based on available width if not specified.
Disables all pagination controls.
Color applied to the active page button.
Color applied to page buttons.
Whether to show first and last page navigation buttons.
Icon for the first page button.
Icon for the previous page button.
Icon for the next page button.
Icon for the last page button.
Text displayed for page ellipsis.
ARIA label for the pagination navigation.
ARIA label template for page buttons.
ARIA label template for the current page button.
ARIA label for first page button.
ARIA label for previous page button.
ARIA label for next page button.
ARIA label for last page button.
Adjusts the vertical spacing of buttons.
Size of the pagination buttons.
Button variant style.
Border radius of buttons.
Border style for buttons.
Elevation depth of buttons.
HTML tag for the root element.
Events
Emitted when the page changes.
Emitted when navigating to the first page.
Emitted when navigating to the previous page.
Emitted when navigating to the next page.
Emitted when navigating to the last page.
Slots
Slot to customize individual page buttons.
first
{ icon: IconValue, onClick: Function, disabled: boolean, aria-label: string, aria-disabled: boolean }
Slot to customize the first page button.
prev
{ icon: IconValue, onClick: Function, disabled: boolean, aria-label: string, aria-disabled: boolean }
Slot to customize the previous page button.
next
{ icon: IconValue, onClick: Function, disabled: boolean, aria-label: string, aria-disabled: boolean }
Slot to customize the next page button.
last
{ icon: IconValue, onClick: Function, disabled: boolean, aria-label: string, aria-disabled: boolean }
Slot to customize the last page button.
Navigation Patterns
With First and Last Buttons
Limited Visible Pages
Custom Styling
Compact Size
Keyboard Navigation
- Arrow Left: Navigate to previous page
- Arrow Right: Navigate to next page
Examples
Event Handling
Zero-Based Indexing
Custom Page Rendering
Responsive Pagination
The component automatically adjusts the number of visible pages based on available screen width whentotalVisible is not specified:
Accessibility
- Uses semantic
<nav>element withrole="navigation" - Provides ARIA labels for all navigation controls
- Sets
aria-currenton the active page - Supports keyboard navigation
- Properly marks disabled states with
aria-disabled