Frontend Pagination Implementation Guide
This guide shows developers how to add pagination to any data table in the DeployStack frontend.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
currentPage: number
- Current page number (1-based)pageSize: number
- Items per pagetotalItems: number
- Total number of itemsisLoading?: boolean
- Loading statepageSizeOptions?: number[]
- Available page sizes (default: [10, 20, 50, 100])
Events
@page-change(page: number)
- Emitted when page changes@page-size-change(pageSize: number)
- Emitted when page size changes
shadcn-vue Components Used
ThePaginationControls
component uses these shadcn-vue components:
Button
- For Previous/Next navigationSelect
,SelectContent
,SelectItem
,SelectTrigger
,SelectValue
- For page size selector- Lucide icons:
ChevronLeft
,ChevronRight
Search Integration
For search functionality, conditionally show pagination:Backend Requirements
Your backend API must support these query parameters:limit
- Number of items per page (1-100)offset
- Number of items to skip