Skip to main content
This guide shows developers how to add pagination to any data table in the DeployStack frontend.

Pagination Style

The pagination follows the shadcn-vue DataTable pattern: Without selection (default):
With selection enabled:
  • Selection info (left, optional) - “X of Y row(s) selected.” Only shown when selection props are provided
  • Rows per page selector (right) - Dropdown with options: 10, 20, 30, 40, 50 (hidden on mobile)
  • Page indicator (right) - “Page X of Y”
  • Navigation buttons (right) - First, Previous, Next, Last (First/Last hidden on mobile)

Quick Implementation

1. Service Layer

Add pagination support to your service:

2. Component Implementation

3. Add Translations

Add to your i18n file (e.g., i18n/locales/en/yourFeature.ts):

PaginationControls Component

Props

Events

  • @page-change(page: number) - Emitted when page changes
  • @page-size-change(pageSize: number) - Emitted when page size changes

With Row Selection

When your table has row selection enabled, pass the selectedCount and totalRows props to show the selection info on the left:

shadcn-vue Components Used

The PaginationControls component uses these shadcn-vue components:
  • Button - For navigation buttons (icon-only, outline variant, size-8)
  • Label - For “Rows per page” label
  • Select, SelectContent, SelectItem, SelectTrigger, SelectValue - For page size selector (w-20)
  • Lucide icons: ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight

Responsive Behavior

The pagination is responsive: On mobile, the navigation buttons use ml-auto to push them to the right edge.

Backend Requirements

Your backend API must support these query parameters:
  • limit - Number of items per page (1-100)
  • offset - Number of items to skip
And return this response format: