Skip to content

Pagination

Divide data with pagination when there is too much of it.

Basic Usage

Set the layout property, using commas to separate layout components. Default is prev, pager, next.

Fewer pages
Fold when more than 7 pages
Basic Usage

With Background Color

Set the background property to add a background color to the pagination buttons.

With Background Color

Extra Features

Enable more features by combining sub-component names in layout. Available sub-components: total (total count), sizes (items per page selector), prev (previous page), pager (page numbers), next (next page), jumper (jump to page), slot (custom content).

Extra Features

Small Pagination

Set the small property to use small-sized pagination, suitable for scenarios with limited space. Buttons and input fields will be correspondingly smaller.

Small Pagination

Circle Pagination

Set the circle property to make pagination buttons circular.

Circle Pagination

Custom Content and Icons

Customize pagination component content or paging icons via slots.

Custom Content and Icons

Use in Nuxt

The Pagination component fully supports Nuxt 3/4 SSR rendering. In Nuxt projects, the component is auto-imported.

Use in Nuxt

SSR Features:

  • ✅ Supports Server-Side Rendering (SEO-friendly)
  • ✅ Automatic Client-Side Hydration
  • ✅ Async Data Sync Binding
  • ✅ Perfect Compatibility with Nuxt's Auto-import mechanism

TIP

When using pagination with useFetch or useAsyncData in the Nuxt ecosystem, ensure that changing the v-model:current-page variable re-triggers the data request.

API

Props

PropDescriptionTypeDefault
current-page / v-model:current-pageCurrent page numbernumber1
totalTotal item countnumber0
page-size / v-model:page-sizeItems per pagenumber10
page-sizesOptions for the page size selectornumber[][10, 20, 30, 40, 50, 100]
layoutComponent layout, sub-components separated by commas (Options: prev, pager, next, jumper, total, sizes, slot)string'prev, pager, next'
pager-countMaximum number of pager buttons; will fold when total pages exceed this valuenumber7
backgroundWhether to enable background color modebooleanfalse
circleWhether to use circular pagination buttonsbooleanfalse
smallWhether to use small paginationbooleanfalse
disabledWhether to disablebooleanfalse
hide-on-single-pageWhether to hide pagination when there's only one pagebooleanfalse
prev-textText string for the "previous page" button (overrides icon)string
next-textText string for the "next page" button (overrides icon)string

Events

Event NameDescriptionCallback Parameters
size-changeTriggered when pageSize changes(val: number) => void
current-changeTriggered when currentPage changes(val: number) => void
prev-clickTriggered when user clicks the "previous" button(val: number) => void
next-clickTriggered when user clicks the "next" button(val: number) => void

Slots

Slot NameDescription
prev-iconCustom previous page icon
next-iconCustom next page icon
defaultCustom content (requires slot in layout)

Expose

NameDescriptionType
currentPageCurrent page numbernumber
pageSizeItems per pagenumber
pageCountTotal page countnumber

Theme Variables

Customize localized styles by overriding these CSS variables:

VariableDefault
--yh-pagination-font-size14px
--yh-pagination-bg-colortransparent
--yh-pagination-text-colorvar(--yh-text-color-regular)
--yh-pagination-btn-width32px
--yh-pagination-btn-height32px
--yh-pagination-btn-hover-colorvar(--yh-color-primary)
--yh-pagination-item-active-bg-colorvar(--yh-color-primary)
--yh-pagination-item-active-color#ffffff

Released under the MIT License.