Migrating from UIPagination to HighRise Pagination
This guide will help you migrate from the ghl-ui Pagination component to the new HighRise Pagination component.
Component Implementation Changes
Import Changes
diff
- import { UIPagination } from '@gohighlevel/ghl-ui'
+ import { HLPagination } from '@platform-ui/highrise'Breaking Changes
The following architectural changes have been made:
Pagination Calculation:
- Old: Used
pageCountprop to determine total pages - New: Uses
totalPagesprop
- Old: Used
Page Size Selection:
- Old: Used
pageSizesprop array of numbers - New: Uses structured
perPageDropdownOptionsprop array with key-label pairs
- Old: Used
Simplified Mode:
- Old: Used
simpleprop - New: Uses
collapsedprop with enhanced layout
- Old: Used
Props Changes
New Required Props:
id: Required for accessibility
Renamed Props:
page→currentPagepageSize→perPagepageSlot→pagesToDisplayshowSizePicker→showPerPageDropDownpageSizes→perPageDropdownOptionssimple→collapsedpageCount→totalPages
New Props:
size: 'sm' | 'md'showCurrentRange: Show current items range, make itfalseshowTotalPages: Show "Page X of Y", make itfalseperPageText: Customize "Rows per page" text, make itfalse
Emits Changes
- Renamed Events:
update:page-size→update:perPage
Examples
Basic Pagination
diff
- <UIPagination
- id="basic-pagination"
- :page-count="10"
- :page="currentPage"
- @update:page="handlePageChange"
- />
+ <HLPagination
+ id="basic-pagination"
+ :current-page="currentPage"
+ :total-pages="10"
+ @update:page="handlePageChange"
+ :show-current-range="false"
+ :show-total-pages="false"
+ :per-page-text="false"
+ :show-per-page-drop-down="false"
+ >
+ <template #prev>Previous</template>
+ <template #next>Next</template>
+ </HLPagination>With Per Page and Item Count
INFO
per-pageis mapped topage-sizein GHL-UItotal-pagesis mapped topage-countin GHL-UI- In HighRise, either
total-pagesoritem-countandper-pageis required
diff
- <UIPagination
- id="basic-pagination"
- :page="currentPage"
- :page-size="10"
- :page-count="10"
- />
+ <HLPagination
+ id="basic-pagination"
+ :current-page="currentPage"
+ :per-page="10"
+ :total-pages="10" <!-- Either total-pages or item-count and per-page is required -->
+ >
+ <template #prev>Previous</template>
+ <template #next>Next</template>
+ </HLPagination>With Page Size Selection
diff
- <UIPagination
- id="pagination-with-size"
- :page-count="totalPages"
- :page="currentPage"
- :page-size="pageSize"
- :show-size-picker="true"
- :page-sizes="[10, 20, 50, 100]"
- @update:page="handlePageChange"
- @update:page-size="handlePageSizeChange"
- />
+ <HLPagination
+ id="pagination-with-size"
+ :current-page="currentPage"
+ :total-pages="totalPages"
+ :per-page="pageSize"
+ :show-per-page-drop-down="true"
+ :per-page-dropdown-options="[
+ { key: 10, label: '10' },
+ { key: 20, label: '20' },
+ { key: 50, label: '50' },
+ { key: 100, label: '100' }
+ ]"
+ :show-current-range="false"
+ :show-total-pages="false"
+ :per-page-text="false"
+ @update:page="handlePageChange"
+ @update:perPage="handlePageSizeChange"
+ >
+ <template #prev>Previous</template>
+ <template #next>Next</template>
+ </HLPagination>Compact/Simple Mode
diff
- <UIPagination
- id="simple-pagination"
- :page-count="10"
- :page="currentPage"
- :simple="true"
- @update:page="handlePageChange"
- />
+ <HLPagination
+ id="compact-pagination"
+ :current-page="currentPage"
+ :total-pages="10"
+ collapsed
+ :show-current-range="false"
+ :show-total-pages="false"
+ :per-page-text="false"
+ :show-per-page-drop-down="false"
+ @update:page="handlePageChange"
+ >
+ <template #prev>Previous</template>
+ <template #next>Next</template>
+ </HLPagination>Only Pages (No Per-Page Selection)
vue
<template>
<HLPagination
id="pages-only"
:current-page="currentPage"
:total-pages="18"
:show-per-page-drop-down="false"
:pages-to-display="7"
size="md"
@update:page="handlePageChange"
>
<template #prev>Previous</template>
<template #next>Next</template>
</HLPagination>
</template>Type Definitions
typescript
interface PerPageOption {
key: number
label: string
}Best Practices
- Always provide unique
idprops for accessibility - Use appropriate size based on context
- Consider using
collapsedmode for compact layouts - Show current range for better user context
- Customize prev/next button text for clarity
- Use consistent per-page options across app
- Handle page changes appropriately
- Consider mobile responsiveness
- Implement proper loading states
- Follow accessibility guidelines
Additional Notes
- The component provides built-in responsive design
- Supports both item-based and page-based calculations
- Enhanced dropdown for per-page selection
- Consistent styling with HighRise design system
- Built-in accessibility features
- Support for RTL layouts
- Improved keyboard navigation
- Better mobile support
- Flexible layout options
- Integration with other HighRise components