Pagination Style
The pagination follows the shadcn-vue DataTable pattern: Without selection (default):- 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
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
currentPage | number | Yes | - | Current page number (1-based) |
pageSize | number | Yes | - | Items per page |
totalItems | number | Yes | - | Total number of items |
isLoading | boolean | No | false | Loading state (disables navigation) |
pageSizeOptions | number[] | No | [10, 20, 30, 40, 50] | Available page sizes |
selectedCount | number | No | - | Number of selected rows (enables selection display) |
totalRows | number | No | - | Total rows for selection display |
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 theselectedCount and totalRows props to show the selection info on the left:
shadcn-vue Components Used
ThePaginationControls component uses these shadcn-vue components:
Button- For navigation buttons (icon-only, outline variant,size-8)Label- For “Rows per page” labelSelect,SelectContent,SelectItem,SelectTrigger,SelectValue- For page size selector (w-20)- Lucide icons:
ChevronLeft,ChevronRight,ChevronsLeft,ChevronsRight
Responsive Behavior
The pagination is responsive:| Element | Desktop | Mobile |
|---|---|---|
| Selection info (if enabled) | Visible | Visible |
| Rows per page selector | Visible | Hidden |
| Page info | Visible | Visible |
| First page button | Visible | Hidden |
| Previous page button | Visible | Visible |
| Next page button | Visible | Visible |
| Last page button | Visible | Hidden |
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

